diff --git a/.gitignore b/.gitignore index a48827e..d3987a5 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,3 @@ build/phplint.cache /test-requirements.txt /.env /.idea/ -/__tests__/_generated/ -/__tests__/_output/ -/__tests__/Support/ diff --git a/ENDPOINTS-COVERAGE.md b/ENDPOINTS-COVERAGE.md new file mode 100644 index 0000000..a2a0dff --- /dev/null +++ b/ENDPOINTS-COVERAGE.md @@ -0,0 +1,868 @@ +# Endpoints Coverage +# Table of Contents + +- [Publications](#publications) + - [/v1/publications/create](#v1publicationscreate) + - [/v1/publications](#v1publications) +- [Qualifications](#qualifications) + - [/v1/qualifications](#v1qualifications) +- [Validations](#validations) + - [/v1/validations](#v1validations) + - [/v1/vouchers/{code}/validate](#v1voucherscodevalidate-deprecated) + - [/v1/promotions/validation](#v1promotionsvalidation-deprecated) + - [/v1/promotions/tiers/{tierId}/validation](#v1promotionstierstieridvalidation-deprecated) +- [Redemptions](#redemptions) + - [/v1/redemptions](#v1redemptions) + - [/v1/redemptions/{redemptionId}](#v1redemptionsredemptionid) + - [/v1/vouchers/{code}/redemption](#v1voucherscoderedemption) + - [/v1/redemptions/{redemptionId}/rollback](#v1redemptionsredemptionidrollback) + - [/v1/promotions/tiers/{promotionTierId}/redemption](#v1promotionstierspromotiontieridredemption-deprecated) + - [/v1/redemptions/{parentRedemptionId}/rollbacks](#v1redemptionsparentredemptionidrollbacks) +- [Vouchers](#vouchers) + - [/v1/vouchers](#v1vouchers) + - [/v1/vouchers/{code}](#v1voucherscode) + - [/v1/vouchers/{code}/enable](#v1voucherscodeenable) + - [/v1/vouchers/{code}/disable](#v1voucherscodedisable) + - [/v1/vouchers/{code}/balance](#v1voucherscodebalance) + - [/v1/vouchers/{code}/transactions](#v1voucherscodetransactions) + - [/v1/vouchers/{code}/transactions/export](#v1voucherscodetransactionsexport) + - [/v1/vouchers/import](#v1vouchersimport) + - [/v1/vouchers/importCSV](#v1vouchersimportcsv) + - [/v1/vouchers/bulk/async](#v1vouchersbulkasync) + - [/v1/vouchers/metadata/async](#v1vouchersmetadataasync) + - [/v1/vouchers/{code}/sessions/{sessionKey}](#v1voucherscodesessionssessionkey) + - [/v1/vouchers/qualification](#v1vouchersqualification-deprecated) +- [Campaigns](#campaigns) + - [/v1/campaigns](#v1campaigns) + - [/v1/campaigns/{campaignId}](#v1campaignscampaignid) + - [/v1/campaigns/{campaignId}/vouchers](#v1campaignscampaignidvouchers) + - [/v1/campaigns/{campaignId}/vouchers/{code}](#v1campaignscampaignidvoucherscode) + - [/v1/campaigns/{campaignId}/import](#v1campaignscampaignidimport) + - [/v1/campaigns/{campaignId}/importCSV](#v1campaignscampaignidimportcsv) + - [/v1/campaigns/qualification](#v1campaignsqualification-deprecated) + - [/v1/campaigns/{campaignId}/enable](#v1campaignscampaignidenable) + - [/v1/campaigns/{campaignId}/disable](#v1campaignscampaigniddisable) +- [Promotions](#promotions) + - [/v1/promotions/tiers](#v1promotionstiers) + - [/v1/promotions/{campaignId}/tiers](#v1promotionscampaignidtiers) + - [/v1/promotions/tiers/{promotionTierId}](#v1promotionstierspromotiontierid) + - [/v1/promotions/tiers/{promotionTierId}/enable](#v1promotionstierspromotiontieridenable) + - [/v1/promotions/tiers/{promotionTierId}/disable](#v1promotionstierspromotiontieriddisable) + - [/v1/promotions/stacks](#v1promotionsstacks) + - [/v1/promotions/{campaignId}/stacks](#v1promotionscampaignidstacks) + - [/v1/promotions/{campaignId}/stacks/{stackId}](#v1promotionscampaignidstacksstackid) +- [Rewards](#rewards) + - [/v1/rewards](#v1rewards) + - [/v1/rewards/{rewardId}](#v1rewardsrewardid) + - [/v1/rewards/{rewardId}/assignments](#v1rewardsrewardidassignments) + - [/v1/rewards/{rewardId}/assignments/{assignmentId}](#v1rewardsrewardidassignmentsassignmentid) +- [Loyalties](#loyalties) + - [/v1/loyalties](#v1loyalties) + - [/v1/loyalties/{campaignId}](#v1loyaltiescampaignid) + - [/v1/loyalties/{campaignId}/members](#v1loyaltiescampaignidmembers) + - [/v1/loyalties/{campaignId}/members/{memberId}](#v1loyaltiescampaignidmembersmemberid) + - [/v1/loyalties/members/{memberId}](#v1loyaltiesmembersmemberid) + - [/v1/loyalties/{campaignId}/members/{memberId}/activities](#v1loyaltiescampaignidmembersmemberidactivities) + - [/v1/loyalties/members/{memberId}/activities](#v1loyaltiesmembersmemberidactivities) + - [/v1/loyalties/{campaignId}/members/{memberId}/balance](#v1loyaltiescampaignidmembersmemberidbalance) + - [/v1/loyalties/members/{memberId}/balance](#v1loyaltiesmembersmemberidbalance) + - [/v1/loyalties/{campaignId}/members/{memberId}/transfers](#v1loyaltiescampaignidmembersmemberidtransfers) + - [/v1/loyalties/{campaignId}/members/{memberId}/transactions](#v1loyaltiescampaignidmembersmemberidtransactions) + - [/v1/loyalties/members/{memberId}/transactions](#v1loyaltiesmembersmemberidtransactions) + - [/v1/loyalties/members/{memberId}/transactions/export](#v1loyaltiesmembersmemberidtransactionsexport) + - [/v1/loyalties/{campaignId}/members/{memberId}/transactions/export](#v1loyaltiescampaignidmembersmemberidtransactionsexport) + - [/v1/loyalties/{campaignId}/members/{memberId}/points-expiration](#v1loyaltiescampaignidmembersmemberidpoints-expiration) + - [/v1/loyalties/{campaignId}/points-expiration/export](#v1loyaltiescampaignidpoints-expirationexport) + - [/v1/loyalties/{campaignId}/earning-rules](#v1loyaltiescampaignidearning-rules) + - [/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}](#v1loyaltiescampaignidearning-rulesearningruleid) + - [/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/enable](#v1loyaltiescampaignidearning-rulesearningruleidenable) + - [/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable](#v1loyaltiescampaignidearning-rulesearningruleiddisable) + - [/v1/loyalties/members/{memberId}/rewards](#v1loyaltiesmembersmemberidrewards) + - [/v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward](#v1loyaltiescampaignidreward-assignmentsassignmentidreward) + - [/v1/loyalties/{campaignId}/reward-assignments](#v1loyaltiescampaignidreward-assignments) + - [/v1/loyalties/{campaignId}/rewards](#v1loyaltiescampaignidrewards) + - [/v1/loyalties/{campaignId}/reward-assignments/{assignmentId}](#v1loyaltiescampaignidreward-assignmentsassignmentid) + - [/v1/loyalties/{campaignId}/rewards/{assignmentId}](#v1loyaltiescampaignidrewardsassignmentid) + - [/v1/loyalties/{campaignId}/members/{memberId}/redemption](#v1loyaltiescampaignidmembersmemberidredemption) + - [/v1/loyalties/members/{memberId}/redemption](#v1loyaltiesmembersmemberidredemption) + - [/v1/loyalties/{campaignId}/tiers](#v1loyaltiescampaignidtiers) + - [/v1/loyalties/{campaignId}/tiers/{loyaltyTierId}](#v1loyaltiescampaignidtiersloyaltytierid) + - [/v1/loyalties/members/{memberId}/tiers](#v1loyaltiesmembersmemberidtiers) + - [/v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/earning-rules](#v1loyaltiescampaignidtiersloyaltytieridearning-rules) + - [/v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/rewards](#v1loyaltiescampaignidtiersloyaltytieridrewards) +- [Customers](#customers) + - [/v1/customers](#v1customers) + - [/v1/customers/{customerId}](#v1customerscustomerid) + - [/v1/customers/{customerId}/permanent-deletion](#v1customerscustomeridpermanent-deletion) + - [/v1/customers/importCSV](#v1customersimportcsv) + - [/v1/customers/bulk/async](#v1customersbulkasync) + - [/v1/customers/metadata/async](#v1customersmetadataasync) + - [/v1/customers/{customerId}/consents](#v1customerscustomeridconsents) + - [/v1/customers/{customerId}/activities](#v1customerscustomeridactivities) + - [/v1/customers/{customerId}/segments](#v1customerscustomeridsegments) +- [Orders](#orders) + - [/v1/orders](#v1orders) + - [/v1/orders/{orderId}](#v1ordersorderid) + - [/v1/orders/import](#v1ordersimport) + - [/v1/orders/export](#v1ordersexport) +- [Products](#products) + - [/v1/products](#v1products) + - [/v1/products/{productId}](#v1productsproductid) + - [/v1/products/bulk/async](#v1productsbulkasync) + - [/v1/products/metadata/async](#v1productsmetadataasync) + - [/v1/skus/{skuId}](#v1skusskuid) + - [/v1/products/{productId}/skus](#v1productsproductidskus) + - [/v1/products/{productId}/skus/{skuId}](#v1productsproductidskusskuid) + - [/v1/products/importCSV](#v1productsimportcsv) + - [/v1/skus/importCSV](#v1skusimportcsv) +- [Product Collections](#product collections) + - [/v1/product-collections](#v1product-collections) + - [/v1/product-collections/{productCollectionId}](#v1product-collectionsproductcollectionid) + - [/v1/product-collections/{productCollectionId}/products](#v1product-collectionsproductcollectionidproducts) +- [Validation Rules](#validation rules) + - [/v1/validation-rules](#v1validation-rules) + - [/v1/validation-rules/{validationRuleId}](#v1validation-rulesvalidationruleid) + - [/v1/validation-rules-assignments](#v1validation-rules-assignments) + - [/v1/validation-rules/{validationRuleId}/assignments](#v1validation-rulesvalidationruleidassignments) + - [/v1/validation-rules/{validationRuleId}/assignments/{assignmentId}](#v1validation-rulesvalidationruleidassignmentsassignmentid) +- [Segments](#segments) + - [/v1/segments/{segmentId}](#v1segmentssegmentid) + - [/v1/segments](#v1segments) +- [Events](#events) + - [/v1/events](#v1events) +- [Consents](#consents) + - [/v1/consents](#v1consents) +- [Async Actions](#async actions) + - [/v1/async-actions](#v1async-actions) + - [/v1/async-actions/{asyncActionId}](#v1async-actionsasyncactionid) +- [Exports](#exports) + - [/v1/exports](#v1exports) + - [/v1/exports/{exportId}](#v1exportsexportid) + - [/v1/exports/{export_Id}](#v1exportsexport_id) +- [Categories](#categories) + - [/v1/categories](#v1categories) + - [/v1/categories/{categoryId}](#v1categoriescategoryid) +- [Metadata Schemas](#metadata schemas) + - [/v1/metadata-schemas](#v1metadata-schemas) + - [/v1/metadata-schemas/{resource}](#v1metadata-schemasresource) +- [Locations](#locations) + - [/v1/locations](#v1locations) + - [/v1/locations/{locationId}](#v1locationslocationid) +- [Client-side](#client-side) + - [/client/v1/qualifications](#clientv1qualifications) + - [/client/v1/promotions/tiers](#clientv1promotionstiers) + - [/client/v1/redemptions](#clientv1redemptions) + - [/client/v1/validations](#clientv1validations) + - [/client/v1/customers/{customerId}/consents](#clientv1customerscustomeridconsents) + - [/client/v1/events](#clientv1events) + - [/client/v1/consents](#clientv1consents) + - [/client/v1/validate](#clientv1validate-deprecated) + - [/client/v1/redeem](#clientv1redeem-deprecated) +# Endpoints + +## Publications +### /v1/publications/create +#### Create Publication (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +### /v1/publications +#### List Publications (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/PublicationsListResponseBody.php) ✅ +#### Create Publication (post) +- **RequestSupported:** [link](./src/Model/PublicationsCreateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/PublicationsCreateResponseBody.php) ✅ +## Qualifications +### /v1/qualifications +#### Check Eligibility (post) +- **RequestSupported:** [link](./src/Model/QualificationsCheckEligibilityResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/QualificationsCheckEligibilityResponseBody.php) ✅ +## Validations +### /v1/validations +#### Validate Stackable Discounts (post) +- **RequestSupported:** [link](./src/Model/ValidationsValidateResponseBody.php) ✅ +- **ResponseSupported:** ❌ +### ~~❗/v1/vouchers/{code}/validate [Deprecated]❗~~ +#### ~~❗Validate Voucher [Deprecated] (post)❗~~ +### ~~❗/v1/promotions/validation [Deprecated]❗~~ +#### ~~❗Validate Promotions [Deprecated] (post)❗~~ +### ~~❗/v1/promotions/tiers/{tierId}/validation [Deprecated]❗~~ +#### ~~❗Validate Promotion Tier [Deprecated] (post)❗~~ +## Redemptions +### /v1/redemptions +#### List Redemptions (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/RedemptionsListResponseBody.php) ✅ +#### Redeem Stackable Discounts (post) +- **RequestSupported:** [link](./src/Model/RedemptionsRedeemResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/RedemptionsRedeemResponseBody.php) ✅ +### /v1/redemptions/{redemptionId} +#### Get Redemption (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/RedemptionsGetResponseBody.php) ✅ +### /v1/vouchers/{code}/redemption +#### Get Voucher's Redemptions (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/VouchersRedemptionGetResponseBody.php) ✅ +#### ~~❗Redeem Voucher [Deprecated] (post)❗~~ +### /v1/redemptions/{redemptionId}/rollback +#### Rollback Redemption (post) +- **RequestSupported:** [link](./src/Model/RedemptionsRollbackCreateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/RedemptionsRollbackCreateResponseBody.php) ✅ +### ~~❗/v1/promotions/tiers/{promotionTierId}/redemption [Deprecated]❗~~ +#### ~~❗Redeem Promotion [Deprecated] (post)❗~~ +### /v1/redemptions/{parentRedemptionId}/rollbacks +#### Rollback Stackable Redemptions (post) +- **RequestSupported:** [link](./src/Model/RedemptionsRollbacksCreateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/RedemptionsRollbacksCreateResponseBody.php) ✅ +## Vouchers +### /v1/vouchers +#### List Vouchers (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +#### Generate Random Code (post) +- **RequestSupported:** ❌ +- **ResponseSupported:** ❌ +### /v1/vouchers/{code} +#### Get Voucher (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/VouchersGetResponseBody.php) ✅ +#### Update Voucher (put) +- **RequestSupported:** ❌ +- **ResponseSupported:** ❌ +#### Delete Voucher (delete) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** *Not applicable* +#### Create Voucher (post) +- **RequestSupported:** ❌ +- **ResponseSupported:** ❌ +### /v1/vouchers/{code}/enable +#### Enable Voucher (post) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/VouchersEnableResponseBody.php) ✅ +### /v1/vouchers/{code}/disable +#### Disable Voucher (post) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/VouchersDisableResponseBody.php) ✅ +### /v1/vouchers/{code}/balance +#### Add or Remove Voucher Balance (post) +- **RequestSupported:** [link](./src/Model/VouchersBalanceUpdateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/VouchersBalanceUpdateResponseBody.php) ✅ +### /v1/vouchers/{code}/transactions +#### List Voucher Transactions (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/VouchersTransactionsListResponseBody.php) ✅ +### /v1/vouchers/{code}/transactions/export +#### Export Voucher Transactions (post) +- **RequestSupported:** [link](./src/Model/VouchersTransactionsExportCreateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/VouchersTransactionsExportCreateResponseBody.php) ✅ +### /v1/vouchers/import +#### Import Vouchers (post) +- **RequestSupported:** ❌ +- **ResponseSupported:** ❌ +### /v1/vouchers/importCSV +#### Import Vouchers using CSV (post) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/VouchersImportCsvCreateResponseBody.php) ✅ +### /v1/vouchers/bulk/async +#### Update Vouchers in bulk (post) +- **RequestSupported:** ❌ +- **ResponseSupported:** ❌ +### /v1/vouchers/metadata/async +#### Update Vouchers' metadata in bulk (post) +- **RequestSupported:** ❌ +- **ResponseSupported:** ❌ +### /v1/vouchers/{code}/sessions/{sessionKey} +#### Release Validation Session (delete) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** *Not applicable* +### ~~❗/v1/vouchers/qualification [Deprecated]❗~~ +#### ~~❗Examine Qualification [Deprecated] (post)❗~~ +## Campaigns +### /v1/campaigns +#### Create Campaign (post) +- **RequestSupported:** [link](./src/Model/CampaignsCreateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/CampaignsCreateResponseBody.php) ✅ +#### List Campaigns (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/CampaignsListResponseBody.php) ✅ +### /v1/campaigns/{campaignId} +#### Get Campaign (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/CampaignsGetResponseBody.php) ✅ +#### Update Campaign (put) +- **RequestSupported:** [link](./src/Model/CampaignsUpdateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/CampaignsUpdateResponseBody.php) ✅ +#### Delete Campaign (delete) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/CampaignsDeleteResponseBody.php) ✅ +### /v1/campaigns/{campaignId}/vouchers +#### Add Vouchers to Campaign (post) +- **RequestSupported:** [link](./src/Model/CampaignsVouchersCreateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/CampaignsVouchersCreateResponseBody.php) ✅ +### /v1/campaigns/{campaignId}/vouchers/{code} +#### Add Voucher with Specific Code to Campaign (post) +- **RequestSupported:** [link](./src/Model/CampaignsVouchersCreateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/CampaignsVouchersCreateResponseBody.php) ✅ +### /v1/campaigns/{campaignId}/import +#### Import Vouchers to Campaign (post) +- **RequestSupported:** [link](./src/Model/CampaignsImportCreateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/CampaignsImportCreateResponseBody.php) ✅ +### /v1/campaigns/{campaignId}/importCSV +#### Import Vouchers to Campaign by CSV (post) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/CampaignsImportCsvCreateResponseBody.php) ✅ +### ~~❗/v1/campaigns/qualification [Deprecated]❗~~ +#### ~~❗Examine Qualification [Deprecated] (post)❗~~ +### /v1/campaigns/{campaignId}/enable +#### Enable Campaign (post) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/CampaignsEnableResponseBody.php) ✅ +### /v1/campaigns/{campaignId}/disable +#### Disable Campaign (post) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/CampaignsDisableResponseBody.php) ✅ +## Promotions +### /v1/promotions/tiers +#### List Promotion Tiers (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +### /v1/promotions/{campaignId}/tiers +#### List Promotion Tiers from Campaign (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/PromotionsTiersListResponseBody.php) ✅ +#### Add Promotion Tier to Campaign (post) +- **RequestSupported:** ❌ +- **ResponseSupported:** ❌ +### /v1/promotions/tiers/{promotionTierId} +#### Get Promotion Tier (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/PromotionsTiersGetResponseBody.php) ✅ +#### Update Promotion Tier (put) +- **RequestSupported:** ❌ +- **ResponseSupported:** ❌ +#### Delete Promotion Tier (delete) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** *Not applicable* +### /v1/promotions/tiers/{promotionTierId}/enable +#### Enable Promotion Tier (post) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/PromotionsTiersEnableResponseBody.php) ✅ +### /v1/promotions/tiers/{promotionTierId}/disable +#### Disable Promotion Tier (post) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/PromotionsTiersDisableResponseBody.php) ✅ +### /v1/promotions/stacks +#### List Promotion Stacks (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/PromotionsStacksListResponseBody.php) ✅ +### /v1/promotions/{campaignId}/stacks +#### List Promotion Stacks in Campaign (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/PromotionsStacksListResponseBody.php) ✅ +#### Create Promotion Stack (post) +- **RequestSupported:** [link](./src/Model/PromotionsStacksCreateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/PromotionsStacksCreateResponseBody.php) ✅ +### /v1/promotions/{campaignId}/stacks/{stackId} +#### Get Promotion Stack (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/PromotionsStacksGetResponseBody.php) ✅ +#### Update Promotion Stack (put) +- **RequestSupported:** [link](./src/Model/PromotionsStacksUpdateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/PromotionsStacksUpdateResponseBody.php) ✅ +#### Delete Promotion Stack (delete) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** *Not applicable* +## Rewards +### /v1/rewards +#### List Rewards (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +#### Create Reward (post) +- **RequestSupported:** ❌ +- **ResponseSupported:** ❌ +### /v1/rewards/{rewardId} +#### Get Reward (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +#### Update Reward (put) +- **RequestSupported:** ❌ +- **ResponseSupported:** ❌ +#### Delete Reward (delete) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** *Not applicable* +### /v1/rewards/{rewardId}/assignments +#### List Reward Assignments (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/RewardsAssignmentsListResponseBody.php) ✅ +#### Create Reward Assignment (post) +- **RequestSupported:** [link](./src/Model/RewardsAssignmentsCreateResponseBody.php) ✅ +- **ResponseSupported:** ❌ +### /v1/rewards/{rewardId}/assignments/{assignmentId} +#### Update Reward Assignment (put) +- **RequestSupported:** [link](./src/Model/RewardsAssignmentsUpdateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/RewardsAssignmentsUpdateResponseBody.php) ✅ +#### Delete Reward Assignment (delete) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** *Not applicable* +#### Get Reward Assignment (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/RewardsAssignmentsGetResponseBody.php) ✅ +## Loyalties +### /v1/loyalties +#### List Loyalty Campaigns (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +#### Create Loyalty Campaign (post) +- **RequestSupported:** ❌ +- **ResponseSupported:** ❌ +### /v1/loyalties/{campaignId} +#### Get Loyalty Campaign (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +#### Update Loyalty Campaign (put) +- **RequestSupported:** ❌ +- **ResponseSupported:** ❌ +#### Delete Loyalty Campaign (delete) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/LoyaltiesDeleteResponseBody.php) ✅ +### /v1/loyalties/{campaignId}/members +#### List Members (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +#### Add Member (post) +- **RequestSupported:** ❌ +- **ResponseSupported:** ❌ +### /v1/loyalties/{campaignId}/members/{memberId} +#### Get Member (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +### /v1/loyalties/members/{memberId} +#### Get Member (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +### /v1/loyalties/{campaignId}/members/{memberId}/activities +#### Get Member Activities (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +### /v1/loyalties/members/{memberId}/activities +#### Get Member Activities (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +### /v1/loyalties/{campaignId}/members/{memberId}/balance +#### Add or Remove Loyalty Card Balance (post) +- **RequestSupported:** [link](./src/Model/LoyaltiesMembersBalanceUpdateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/LoyaltiesMembersBalanceUpdateResponseBody.php) ✅ +### /v1/loyalties/members/{memberId}/balance +#### Add or Remove Loyalty Card Balance (post) +- **RequestSupported:** [link](./src/Model/LoyaltiesMembersBalanceUpdateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/LoyaltiesMembersBalanceUpdateResponseBody.php) ✅ +### /v1/loyalties/{campaignId}/members/{memberId}/transfers +#### Transfer Loyalty Points (post) +- **RequestSupported:** [link](./src/Model/LoyaltiesMembersTransfersCreateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/LoyaltiesMembersTransfersCreateResponseBody.php) ✅ +### /v1/loyalties/{campaignId}/members/{memberId}/transactions +#### List Loyalty Card Transactions (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/LoyaltiesMembersTransactionsListResponseBody.php) ✅ +### /v1/loyalties/members/{memberId}/transactions +#### List Loyalty Card Transactions (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/LoyaltiesMembersTransactionsListResponseBody.php) ✅ +### /v1/loyalties/members/{memberId}/transactions/export +#### Export Loyalty Card Transactions (post) +- **RequestSupported:** [link](./src/Model/LoyaltiesMembersTransactionsExportCreateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/LoyaltiesMembersTransactionsExportCreateResponseBody.php) ✅ +### /v1/loyalties/{campaignId}/members/{memberId}/transactions/export +#### Export Loyalty Card Transactions (post) +- **RequestSupported:** [link](./src/Model/LoyaltiesMembersTransactionsExportCreateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/LoyaltiesMembersTransactionsExportCreateResponseBody.php) ✅ +### /v1/loyalties/{campaignId}/members/{memberId}/points-expiration +#### Get Points Expiration (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/LoyaltiesMembersPointsExpirationListResponseBody.php) ✅ +### /v1/loyalties/{campaignId}/points-expiration/export +#### Create Points Expiration Export (post) +- **RequestSupported:** ❌ +- **ResponseSupported:** ❌ +### /v1/loyalties/{campaignId}/earning-rules +#### List Earning Rules (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +#### Create Earning Rule (post) +- **RequestSupported:** ❌ +- **ResponseSupported:** *Not applicable* +### /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} +#### Get Earning Rule (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/LoyaltiesEarningRulesGetResponseBody.php) ✅ +#### Update Earning Rule (put) +- **RequestSupported:** ❌ +- **ResponseSupported:** ❌ +#### Delete Earning Rule (delete) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** *Not applicable* +### /v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/enable +#### Enable Earning Rule (post) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/LoyaltiesEarningRulesEnableResponseBody.php) ✅ +### /v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable +#### Disable Earning Rule (post) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/LoyaltiesEarningRulesDisableResponseBody.php) ✅ +### /v1/loyalties/members/{memberId}/rewards +#### List Member Rewards (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/LoyaltiesMembersRewardsListResponseBody.php) ✅ +### /v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward +#### Get Reward Details (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/LoyaltiesRewardAssignmentsRewardGetResponseBody.php) ✅ +### /v1/loyalties/{campaignId}/reward-assignments +#### List Reward Assignments (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +### /v1/loyalties/{campaignId}/rewards +#### List Reward Assignments (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +#### Create Reward Assignment (post) +- **RequestSupported:** ❌ +- **ResponseSupported:** ❌ +### /v1/loyalties/{campaignId}/reward-assignments/{assignmentId} +#### Get Reward Assignment (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/LoyaltiesRewardAssignmentsGetResponseBody.php) ✅ +### /v1/loyalties/{campaignId}/rewards/{assignmentId} +#### Get Reward Assignment (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/LoyaltiesRewardsGetResponseBody.php) ✅ +#### Update Reward Assignment (put) +- **RequestSupported:** [link](./src/Model/4_obj_reward_assignment_object.php) ✅ +- **ResponseSupported:** ❌ +#### Delete Reward Assignment (delete) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** *Not applicable* +### /v1/loyalties/{campaignId}/members/{memberId}/redemption +#### Redeem Reward (post) +- **RequestSupported:** [link](./src/Model/LoyaltiesMembersRedemptionRedeemResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/LoyaltiesMembersRedemptionRedeemResponseBody.php) ✅ +### /v1/loyalties/members/{memberId}/redemption +#### Redeem Reward (post) +- **RequestSupported:** [link](./src/Model/LoyaltiesMembersRedemptionRedeemResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/LoyaltiesMembersRedemptionRedeemResponseBody.php) ✅ +### /v1/loyalties/{campaignId}/tiers +#### List Loyalty Tiers (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/LoyaltiesTiersListResponseBody.php) ✅ +#### Create loyalty tiers (post) +- **RequestSupported:** [link](./src/Model/LoyaltiesTiersCreateInBulkResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/LoyaltiesTiersCreateInBulkResponseBody.php) ✅ +### /v1/loyalties/{campaignId}/tiers/{loyaltyTierId} +#### Get Loyalty Tier (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/LoyaltiesTiersGetResponseBody.php) ✅ +### /v1/loyalties/members/{memberId}/tiers +#### List Member's Loyalty Tiers (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/LoyaltiesMembersTiersListResponseBody.php) ✅ +### /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/earning-rules +#### List Loyalty Tier Earning Rules (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/LoyaltiesTiersEarningRulesListResponseBody.php) ✅ +### /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/rewards +#### List Loyalty Tier Rewards (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/LoyaltiesTiersRewardsListResponseBody.php) ✅ +## Customers +### /v1/customers +#### List Customers (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/CustomersListResponseBody.php) ✅ +#### Create Customer (post) +- **RequestSupported:** [link](./src/Model/CustomersCreateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/CustomersCreateResponseBody.php) ✅ +### /v1/customers/{customerId} +#### Get Customer (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/CustomersGetResponseBody.php) ✅ +#### Delete Customer (delete) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** *Not applicable* +#### Update Customer (put) +- **RequestSupported:** [link](./src/Model/CustomersUpdateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/CustomersUpdateResponseBody.php) ✅ +### /v1/customers/{customerId}/permanent-deletion +#### Delete Customer Permanently (post) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/CustomersPermanentDeletionCreateResponseBody.php) ✅ +### /v1/customers/importCSV +#### Import and Update Customers using CSV (post) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/CustomersImportCsvCreateResponseBody.php) ✅ +### /v1/customers/bulk/async +#### Update Customers in bulk (post) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/CustomersUpdateInBulkResponseBody.php) ✅ +### /v1/customers/metadata/async +#### Update Customers' Metadata in bulk (post) +- **RequestSupported:** [link](./src/Model/CustomersMetadataUpdateInBulkResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/CustomersMetadataUpdateInBulkResponseBody.php) ✅ +### /v1/customers/{customerId}/consents +#### Update Customer's consents (put) +- **RequestSupported:** [link](./src/Model/null.php) ✅ +- **ResponseSupported:** *Not applicable* +### /v1/customers/{customerId}/activities +#### List Customer Activities (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/CustomersActivitiesListResponseBody.php) ✅ +### /v1/customers/{customerId}/segments +#### List Customer's Segments (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/CustomersSegmentsListResponseBody.php) ✅ +## Orders +### /v1/orders +#### List Orders (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/OrdersListResponseBody.php) ✅ +#### Create Order (post) +- **RequestSupported:** [link](./src/Model/OrdersCreateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/OrdersCreateResponseBody.php) ✅ +### /v1/orders/{orderId} +#### Get Order (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/OrdersGetResponseBody.php) ✅ +#### Update Order (put) +- **RequestSupported:** [link](./src/Model/OrdersUpdateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/OrdersUpdateResponseBody.php) ✅ +### /v1/orders/import +#### Import Orders (post) +- **RequestSupported:** [link](./src/Model/OrdersImportCreateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/OrdersImportCreateResponseBody.php) ✅ +### /v1/orders/export +#### Create Orders Export (post) +- **RequestSupported:** [link](./src/Model/OrdersExportCreateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/OrdersExportCreateResponseBody.php) ✅ +## Products +### /v1/products +#### List Products (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/ProductsListResponseBody.php) ✅ +#### Create Product (post) +- **RequestSupported:** [link](./src/Model/ProductsCreateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/ProductsCreateResponseBody.php) ✅ +### /v1/products/{productId} +#### Get Product (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/ProductsGetResponseBody.php) ✅ +#### Update Product (put) +- **RequestSupported:** [link](./src/Model/ProductsUpdateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/ProductsUpdateResponseBody.php) ✅ +#### Delete Product (delete) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** *Not applicable* +### /v1/products/bulk/async +#### Update Products in bulk (post) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/ProductsUpdateInBulkResponseBody.php) ✅ +### /v1/products/metadata/async +#### Update Products' Metadata in bulk (post) +- **RequestSupported:** [link](./src/Model/ProductsMetadataUpdateInBulkResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/ProductsMetadataUpdateInBulkResponseBody.php) ✅ +### /v1/skus/{skuId} +#### Get SKU (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/SkusGetResponseBody.php) ✅ +### /v1/products/{productId}/skus +#### List SKUs in Product (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/ProductsSkusListResponseBody.php) ✅ +#### Create SKU (post) +- **RequestSupported:** [link](./src/Model/ProductsSkusCreateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/ProductsSkusCreateResponseBody.php) ✅ +### /v1/products/{productId}/skus/{skuId} +#### Update SKU (put) +- **RequestSupported:** [link](./src/Model/ProductsSkusUpdateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/ProductsSkusUpdateResponseBody.php) ✅ +#### Delete SKU (delete) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** *Not applicable* +### /v1/products/importCSV +#### Import Products using CSV (post) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/ProductsImportCsvCreateResponseBody.php) ✅ +### /v1/skus/importCSV +#### Import SKUs using CSV (post) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/SkusImportCsvCreateResponseBody.php) ✅ +## Product Collections +### /v1/product-collections +#### List Product Collections (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/ProductCollectionsListResponseBody.php) ✅ +#### Create Product Collection (post) +- **RequestSupported:** [link](./src/Model/ProductCollectionsCreateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/ProductCollectionsCreateResponseBody.php) ✅ +### /v1/product-collections/{productCollectionId} +#### Get Product Collection (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/ProductCollectionsGetResponseBody.php) ✅ +#### Delete Product Collection (delete) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** *Not applicable* +### /v1/product-collections/{productCollectionId}/products +#### List Products in Collection (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/ProductCollectionsProductsListResponseBody.php) ✅ +## Validation Rules +### /v1/validation-rules +#### List Validation Rules (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/ValidationRulesListResponseBody.php) ✅ +#### Create Validation Rules (post) +- **RequestSupported:** [link](./src/Model/ValidationRulesCreateResponseBody.php) ✅ +- **ResponseSupported:** ❌ +### /v1/validation-rules/{validationRuleId} +#### Get Validation Rule (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/ValidationRulesGetResponseBody.php) ✅ +#### Update Validation Rule (put) +- **RequestSupported:** [link](./src/Model/ValidationRulesUpdateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/ValidationRulesUpdateResponseBody.php) ✅ +#### Delete Validation Rule (delete) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** *Not applicable* +### /v1/validation-rules-assignments +#### List Validation Rules' Assignment(s) (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/ValidationRulesAssignmentsListResponseBody.php) ✅ +### /v1/validation-rules/{validationRuleId}/assignments +#### List Validation Rule Assignments (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/ValidationRulesAssignmentsListResponseBody.php) ✅ +#### Create Validation Rules Assignments (post) +- **RequestSupported:** ❌ +- **ResponseSupported:** ❌ +### /v1/validation-rules/{validationRuleId}/assignments/{assignmentId} +#### Delete Validation Rule Assignment (delete) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** *Not applicable* +## Segments +### /v1/segments/{segmentId} +#### Get Segment (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +#### Delete Segment (delete) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** *Not applicable* +### /v1/segments +#### Create Segment (post) +- **RequestSupported:** ❌ +- **ResponseSupported:** ❌ +## Events +### /v1/events +#### Track Custom Event (post) +- **RequestSupported:** [link](./src/Model/EventsCreateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/EventsCreateResponseBody.php) ✅ +## Consents +### /v1/consents +#### List Consents (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +## Async Actions +### /v1/async-actions +#### List Async Actions (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +### /v1/async-actions/{asyncActionId} +#### Get Async Action (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +## Exports +### /v1/exports +#### Create Export (post) +- **RequestSupported:** [link](./src/Model/ExportsCreateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/ExportsCreateResponseBody.php) ✅ +#### List Exports (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/ExportsListResponseBody.php) ✅ +### /v1/exports/{exportId} +#### Get Export (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/ExportsGetResponseBody.php) ✅ +#### Delete Export (delete) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** *Not applicable* +### /v1/exports/{export_Id} +#### Download Export (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** *Not applicable* +## Categories +### /v1/categories +#### List Categories (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/CategoriesListResponseBody.php) ✅ +#### Create Category (post) +- **RequestSupported:** [link](./src/Model/CategoriesCreateResponseBody.php) ✅ +- **ResponseSupported:** ❌ +### /v1/categories/{categoryId} +#### Get Category (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** [link](./src/Model/CategoriesGetResponseBody.php) ✅ +#### Delete Category (delete) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** *Not applicable* +#### Update Category (put) +- **RequestSupported:** [link](./src/Model/CategoriesUpdateResponseBody.php) ✅ +- **ResponseSupported:** ❌ +## Metadata Schemas +### /v1/metadata-schemas +#### List Metadata Schemas (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +### /v1/metadata-schemas/{resource} +#### Get Metadata Schema (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +## Locations +### /v1/locations +#### List Locations (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +### /v1/locations/{locationId} +#### Get Location (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +## Client-side +### /client/v1/qualifications +#### Check Eligibility (client-side) (post) +- **RequestSupported:** [link](./src/Model/ClientQualificationsCheckEligibilityResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/ClientQualificationsCheckEligibilityResponseBody.php) ✅ +### /client/v1/promotions/tiers +#### List Promotion Tiers (client-side) (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +### /client/v1/redemptions +#### Redeem Stackable Discounts (client-side) (post) +- **RequestSupported:** [link](./src/Model/ClientRedemptionsRedeemResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/ClientRedemptionsRedeemResponseBody.php) ✅ +### /client/v1/validations +#### Validate Stackable Discounts (client-side) (post) +- **RequestSupported:** [link](./src/Model/ClientValidationsValidateResponseBody.php) ✅ +- **ResponseSupported:** ❌ +### /client/v1/customers/{customerId}/consents +#### Update Customer's consents (client-side) (put) +- **RequestSupported:** [link](./src/Model/null.php) ✅ +- **ResponseSupported:** *Not applicable* +### /client/v1/events +#### Track Custom Event (client-side) (post) +- **RequestSupported:** [link](./src/Model/ClientEventsCreateResponseBody.php) ✅ +- **ResponseSupported:** [link](./src/Model/ClientEventsCreateResponseBody.php) ✅ +### /client/v1/consents +#### List Consents (client-side) (get) +- **RequestSupported:** *Not applicable* +- **ResponseSupported:** ❌ +### ~~❗/client/v1/validate [Deprecated]❗~~ +#### ~~❗Validate Voucher (client-side) [Deprecated] (get)❗~~ +### ~~❗/client/v1/redeem [Deprecated]❗~~ +#### ~~❗Redeem Voucher (client-side) [Deprecated] (post)❗~~ \ No newline at end of file diff --git a/README.md b/README.md index 1280524..8ac93d3 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,11 @@ Class | Method | HTTP request | Description *CategoriesApi* | [**getCategory**](docs/Api/CategoriesApi.md#getcategory) | **GET** /v1/categories/{categoryId} | Get Category *CategoriesApi* | [**listCategories**](docs/Api/CategoriesApi.md#listcategories) | **GET** /v1/categories | List Categories *CategoriesApi* | [**updateCategory**](docs/Api/CategoriesApi.md#updatecategory) | **PUT** /v1/categories/{categoryId} | Update Category +*ClientSideApi* | [**checkEligibilityClientSide**](docs/Api/ClientSideApi.md#checkeligibilityclientside) | **POST** /client/v1/qualifications | Check Eligibility (client-side) +*ClientSideApi* | [**redeemStackedDiscountsClientSide**](docs/Api/ClientSideApi.md#redeemstackeddiscountsclientside) | **POST** /client/v1/redemptions | Redeem Stackable Discounts (client-side) +*ClientSideApi* | [**trackCustomEventClientSide**](docs/Api/ClientSideApi.md#trackcustomeventclientside) | **POST** /client/v1/events | Track Custom Event (client-side) +*ClientSideApi* | [**updateCustomersConsentsClientSide**](docs/Api/ClientSideApi.md#updatecustomersconsentsclientside) | **PUT** /client/v1/customers/{customerId}/consents | Update Customer's consents (client-side) +*ClientSideApi* | [**validateStackedDiscountsClientSide**](docs/Api/ClientSideApi.md#validatestackeddiscountsclientside) | **POST** /client/v1/validations | Validate Stackable Discounts (client-side) *CustomersApi* | [**createCustomer**](docs/Api/CustomersApi.md#createcustomer) | **POST** /v1/customers | Create Customer *CustomersApi* | [**customerPermanentlyDeletion**](docs/Api/CustomersApi.md#customerpermanentlydeletion) | **POST** /v1/customers/{customerId}/permanent-deletion | Delete Customer Permanently *CustomersApi* | [**deleteCustomer**](docs/Api/CustomersApi.md#deletecustomer) | **DELETE** /v1/customers/{customerId} | Delete Customer @@ -111,11 +116,9 @@ Class | Method | HTTP request | Description *CustomersApi* | [**listCustomers**](docs/Api/CustomersApi.md#listcustomers) | **GET** /v1/customers | List Customers *CustomersApi* | [**updateCustomer**](docs/Api/CustomersApi.md#updatecustomer) | **PUT** /v1/customers/{customerId} | Update Customer *CustomersApi* | [**updateCustomersConsents**](docs/Api/CustomersApi.md#updatecustomersconsents) | **PUT** /v1/customers/{customerId}/consents | Update Customer's consents -*CustomersApi* | [**updateCustomersConsentsClientSide**](docs/Api/CustomersApi.md#updatecustomersconsentsclientside) | **PUT** /client/v1/customers/{customerId}/consents | Update Customer's consents (client-side) *CustomersApi* | [**updateCustomersInBulk**](docs/Api/CustomersApi.md#updatecustomersinbulk) | **POST** /v1/customers/bulk/async | Update Customers in bulk *CustomersApi* | [**updateCustomersMetadataInBulk**](docs/Api/CustomersApi.md#updatecustomersmetadatainbulk) | **POST** /v1/customers/metadata/async | Update Customers' Metadata in bulk *EventsApi* | [**trackCustomEvent**](docs/Api/EventsApi.md#trackcustomevent) | **POST** /v1/events | Track Custom Event -*EventsApi* | [**trackCustomEventClientSide**](docs/Api/EventsApi.md#trackcustomeventclientside) | **POST** /client/v1/events | Track Custom Event (client-side) *ExportsApi* | [**createExport**](docs/Api/ExportsApi.md#createexport) | **POST** /v1/exports | Create Export *ExportsApi* | [**deleteExport**](docs/Api/ExportsApi.md#deleteexport) | **DELETE** /v1/exports/{exportId} | Delete Export *ExportsApi* | [**downloadExport**](docs/Api/ExportsApi.md#downloadexport) | **GET** /v1/exports/{export_Id} | Download Export @@ -187,11 +190,12 @@ Class | Method | HTTP request | Description *PublicationsApi* | [**createPublication1**](docs/Api/PublicationsApi.md#createpublication1) | **GET** /v1/publications/create | Create Publication *PublicationsApi* | [**listPublications**](docs/Api/PublicationsApi.md#listpublications) | **GET** /v1/publications | List Publications *QualificationsApi* | [**checkEligibility**](docs/Api/QualificationsApi.md#checkeligibility) | **POST** /v1/qualifications | Check Eligibility -*QualificationsApi* | [**checkEligibilityClientSide**](docs/Api/QualificationsApi.md#checkeligibilityclientside) | **POST** /client/v1/qualifications | Check Eligibility (client-side) *RedemptionsApi* | [**getRedemption**](docs/Api/RedemptionsApi.md#getredemption) | **GET** /v1/redemptions/{redemptionId} | Get Redemption *RedemptionsApi* | [**getVoucherRedemptions**](docs/Api/RedemptionsApi.md#getvoucherredemptions) | **GET** /v1/vouchers/{code}/redemption | Get Voucher's Redemptions *RedemptionsApi* | [**listRedemptions**](docs/Api/RedemptionsApi.md#listredemptions) | **GET** /v1/redemptions | List Redemptions +*RedemptionsApi* | [**redeemStackedDiscounts**](docs/Api/RedemptionsApi.md#redeemstackeddiscounts) | **POST** /v1/redemptions | Redeem Stackable Discounts *RedemptionsApi* | [**rollbackRedemption**](docs/Api/RedemptionsApi.md#rollbackredemption) | **POST** /v1/redemptions/{redemptionId}/rollback | Rollback Redemption +*RedemptionsApi* | [**rollbackStackedRedemptions**](docs/Api/RedemptionsApi.md#rollbackstackedredemptions) | **POST** /v1/redemptions/{parentRedemptionId}/rollbacks | Rollback Stackable Redemptions *RewardsApi* | [**createRewardAssignment**](docs/Api/RewardsApi.md#createrewardassignment) | **POST** /v1/rewards/{rewardId}/assignments | Create Reward Assignment *RewardsApi* | [**deleteReward**](docs/Api/RewardsApi.md#deletereward) | **DELETE** /v1/rewards/{rewardId} | Delete Reward *RewardsApi* | [**deleteRewardAssignment**](docs/Api/RewardsApi.md#deleterewardassignment) | **DELETE** /v1/rewards/{rewardId}/assignments/{assignmentId} | Delete Reward Assignment @@ -199,11 +203,6 @@ Class | Method | HTTP request | Description *RewardsApi* | [**listRewardAssignments**](docs/Api/RewardsApi.md#listrewardassignments) | **GET** /v1/rewards/{rewardId}/assignments | List Reward Assignments *RewardsApi* | [**updateRewardAssignment**](docs/Api/RewardsApi.md#updaterewardassignment) | **PUT** /v1/rewards/{rewardId}/assignments/{assignmentId} | Update Reward Assignment *SegmentsApi* | [**deleteSegment**](docs/Api/SegmentsApi.md#deletesegment) | **DELETE** /v1/segments/{segmentId} | Delete Segment -*StackableDiscountsApi* | [**redeemStackedDiscounts**](docs/Api/StackableDiscountsApi.md#redeemstackeddiscounts) | **POST** /v1/redemptions | Redeem Stackable Discounts -*StackableDiscountsApi* | [**redeemStackedDiscountsClientSide**](docs/Api/StackableDiscountsApi.md#redeemstackeddiscountsclientside) | **POST** /client/v1/redemptions | Redeem Stackable Discounts (client-side) -*StackableDiscountsApi* | [**rollbackStackedRedemptions**](docs/Api/StackableDiscountsApi.md#rollbackstackedredemptions) | **POST** /v1/redemptions/{parentRedemptionId}/rollbacks | Rollback Stackable Redemptions -*StackableDiscountsApi* | [**validateStackedDiscounts**](docs/Api/StackableDiscountsApi.md#validatestackeddiscounts) | **POST** /v1/validations | Validate Stackable Discounts -*StackableDiscountsApi* | [**validateStackedDiscountsClientSide**](docs/Api/StackableDiscountsApi.md#validatestackeddiscountsclientside) | **POST** /client/v1/validations | Validate Stackable Discounts (client-side) *ValidationRulesApi* | [**createValidationRules**](docs/Api/ValidationRulesApi.md#createvalidationrules) | **POST** /v1/validation-rules | Create Validation Rules *ValidationRulesApi* | [**deleteValidationRuleAssignment**](docs/Api/ValidationRulesApi.md#deletevalidationruleassignment) | **DELETE** /v1/validation-rules/{validationRuleId}/assignments/{assignmentId} | Delete Validation Rule Assignment *ValidationRulesApi* | [**deleteValidationRules**](docs/Api/ValidationRulesApi.md#deletevalidationrules) | **DELETE** /v1/validation-rules/{validationRuleId} | Delete Validation Rule @@ -212,6 +211,7 @@ Class | Method | HTTP request | Description *ValidationRulesApi* | [**listValidationRules**](docs/Api/ValidationRulesApi.md#listvalidationrules) | **GET** /v1/validation-rules | List Validation Rules *ValidationRulesApi* | [**listValidationRulesAssignments**](docs/Api/ValidationRulesApi.md#listvalidationrulesassignments) | **GET** /v1/validation-rules-assignments | List Validation Rules' Assignment(s) *ValidationRulesApi* | [**updateValidationRule**](docs/Api/ValidationRulesApi.md#updatevalidationrule) | **PUT** /v1/validation-rules/{validationRuleId} | Update Validation Rule +*ValidationsApi* | [**validateStackedDiscounts**](docs/Api/ValidationsApi.md#validatestackeddiscounts) | **POST** /v1/validations | Validate Stackable Discounts *VouchersApi* | [**deleteVoucher**](docs/Api/VouchersApi.md#deletevoucher) | **DELETE** /v1/vouchers/{code} | Delete Voucher *VouchersApi* | [**disableVoucher**](docs/Api/VouchersApi.md#disablevoucher) | **POST** /v1/vouchers/{code}/disable | Disable Voucher *VouchersApi* | [**enableVoucher**](docs/Api/VouchersApi.md#enablevoucher) | **POST** /v1/vouchers/{code}/enable | Enable Voucher @@ -600,6 +600,8 @@ Class | Method | HTTP request | Description - [QualificationsFiltersCondition](docs/Model/QualificationsFiltersCondition.md) - [QualificationsOption](docs/Model/QualificationsOption.md) - [QualificationsOptionFilters](docs/Model/QualificationsOptionFilters.md) +- [QualificationsOptionFiltersResourceType](docs/Model/QualificationsOptionFiltersResourceType.md) +- [QualificationsOptionFiltersResourceTypeConditions](docs/Model/QualificationsOptionFiltersResourceTypeConditions.md) - [QualificationsRedeemable](docs/Model/QualificationsRedeemable.md) - [QualificationsRedeemableBase](docs/Model/QualificationsRedeemableBase.md) - [QualificationsRedeemables](docs/Model/QualificationsRedeemables.md) diff --git a/__tests__/Unit/MainTest.php b/__tests__/Unit/MainTest.php index 75358de..76e8072 100644 --- a/__tests__/Unit/MainTest.php +++ b/__tests__/Unit/MainTest.php @@ -46,7 +46,7 @@ protected function _before() new GuzzleHttp\Client(), $config ); - $this->stackedDiscountsApiInstance = new OpenAPI\Client\Api\StackableDiscountsApi( + $this->validationsApiInstance = new OpenAPI\Client\Api\ValidationsApi( new GuzzleHttp\Client(), $config ); @@ -238,7 +238,7 @@ public function testCheckEligibilityAndDoStackedValidationAndRedemption() $voucher_redeemable->setObject("voucher"); array_push($validations_validate_request_body_redeemables, $voucher_redeemable); $validations_validate_request_body->setRedeemables($validations_validate_request_body_redeemables); - $this->stackedDiscountsApiInstance->validateStackedDiscounts($validations_validate_request_body); + $this->validationsApiInstance->validateStackedDiscounts($validations_validate_request_body); // stacked redemption $redemptions_redeem_request_body = new \OpenAPI\Client\Model\RedemptionsRedeemRequestBody(); @@ -248,7 +248,7 @@ public function testCheckEligibilityAndDoStackedValidationAndRedemption() $redemptions_redeem_request_body->setCustomer(new \OpenAPI\Client\Model\Customer()); $redemptions_redeem_request_body->getCustomer()->setSourceId($created_customer->getSourceId()); $redemptions_redeem_request_body->setRedeemables($validations_validate_request_body_redeemables); - $this->stackedDiscountsApiInstance->redeemStackedDiscounts($redemptions_redeem_request_body); + $this->redemptionsApiInstance->redeemStackedDiscounts($redemptions_redeem_request_body); } public function testListRedemptions() diff --git a/composer.json b/composer.json index 69b5f76..8cc8860 100644 --- a/composer.json +++ b/composer.json @@ -30,14 +30,10 @@ "codeception/module-asserts": "*" }, "autoload": { - "psr-4": { - "OpenAPI\\Client\\": "src/" - } + "psr-4": { "OpenAPI\\Client\\" : "src/" } }, "autoload-dev": { - "psr-4": { - "OpenAPI\\Client\\Test\\": "tests/" - } + "psr-4": { "OpenAPI\\Client\\Test\\" : "tests/" } }, "scripts": { "test": [ diff --git a/docs/Api/ClientSideApi.md b/docs/Api/ClientSideApi.md new file mode 100644 index 0000000..d738117 --- /dev/null +++ b/docs/Api/ClientSideApi.md @@ -0,0 +1,354 @@ +# OpenAPI\Client\ClientSideApi + +All URIs are relative to https://api.voucherify.io, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**checkEligibilityClientSide()**](ClientSideApi.md#checkEligibilityClientSide) | **POST** /client/v1/qualifications | Check Eligibility (client-side) | +| [**redeemStackedDiscountsClientSide()**](ClientSideApi.md#redeemStackedDiscountsClientSide) | **POST** /client/v1/redemptions | Redeem Stackable Discounts (client-side) | +| [**trackCustomEventClientSide()**](ClientSideApi.md#trackCustomEventClientSide) | **POST** /client/v1/events | Track Custom Event (client-side) | +| [**updateCustomersConsentsClientSide()**](ClientSideApi.md#updateCustomersConsentsClientSide) | **PUT** /client/v1/customers/{customerId}/consents | Update Customer's consents (client-side) | +| [**validateStackedDiscountsClientSide()**](ClientSideApi.md#validateStackedDiscountsClientSide) | **POST** /client/v1/validations | Validate Stackable Discounts (client-side) | + + +## `checkEligibilityClientSide()` + +```php +checkEligibilityClientSide($client_qualifications_check_eligibility_request_body): \OpenAPI\Client\Model\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](ref:examine-campaigns-qualification), [Voucher Qualifications](ref:examine-vouchers-qualification), and [Promotions Validation](ref:validate-promotions) 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](doc:checking-eligibility). ## 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 parameter's 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 + +```php +setApiKey('X-Client-Application-Id', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Client-Application-Id', 'Bearer'); + +// Configure API key authorization: X-Client-Token +$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-Client-Token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Client-Token', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\ClientSideApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$client_qualifications_check_eligibility_request_body = new \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBody(); // \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBody | Define order and customer context. + +try { + $result = $apiInstance->checkEligibilityClientSide($client_qualifications_check_eligibility_request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClientSideApi->checkEligibilityClientSide: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **client_qualifications_check_eligibility_request_body** | [**\OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBody**](../Model/ClientQualificationsCheckEligibilityRequestBody.md)| Define order and customer context. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ClientQualificationsCheckEligibilityResponseBody**](../Model/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` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `redeemStackedDiscountsClientSide()` + +```php +redeemStackedDiscountsClientSide($origin, $client_redemptions_redeem_request_body): \OpenAPI\Client\Model\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: | **Field** | **Calculation** | **Description** | |:---|:---|:---| | amount | N/A | This field shows the order amount before applying any discount | | total_amount | `total_amount` = `amount` - `total_discount_amount` | This field shows the order amount after applying all the discounts | | discount_amount | `discount_amount` = `previous_discount_amount` + `applied_discount_amount` | This field sums up all order-level discounts up to and including the specific discount being calculated for the stacked redemption. | | items_discount_amount | sum(items, i => i.discount_amount) | This field sums up all product-specific discounts | | total_discount_amount | `total_discount_amount` = `discount_amount` + `items_discount_amount` | This field sums up all order-level and all product-specific discounts | | applied_discount_amount | N/A | This field shows the order-level discount applied in a particular request | | items_applied_discount_amount | sum(items, i => i.applied_discount_amount) | This field sums up all product-specific discounts applied in a particular request | | total_applied_discount_amount | `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | This field sums up all order-level and all product-specific discounts applied in a particular request | > 📘 Rollbacks > > You can't 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](ref:rollback-stacked-redemptions). + +### Example + +```php +setApiKey('X-Client-Application-Id', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Client-Application-Id', 'Bearer'); + +// Configure API key authorization: X-Client-Token +$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-Client-Token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Client-Token', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\ClientSideApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$origin = 'origin_example'; // string | 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"}}}; // \OpenAPI\Client\Model\ClientRedemptionsRedeemRequestBody + +try { + $result = $apiInstance->redeemStackedDiscountsClientSide($origin, $client_redemptions_redeem_request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClientSideApi->redeemStackedDiscountsClientSide: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **origin** | **string**| Indicates the origin (scheme, hostname, and port). | | +| **client_redemptions_redeem_request_body** | [**\OpenAPI\Client\Model\ClientRedemptionsRedeemRequestBody**](../Model/ClientRedemptionsRedeemRequestBody.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ClientRedemptionsRedeemResponseBody**](../Model/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` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `trackCustomEventClientSide()` + +```php +trackCustomEventClientSide($origin, $client_events_create_request_body): \OpenAPI\Client\Model\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 doesn't exist in Voucherify, the customer will be created. + +### Example + +```php +setApiKey('X-Client-Application-Id', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Client-Application-Id', 'Bearer'); + +// Configure API key authorization: X-Client-Token +$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-Client-Token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Client-Token', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\ClientSideApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$origin = 'origin_example'; // string | 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}}; // \OpenAPI\Client\Model\ClientEventsCreateRequestBody | Specify the details of the custom event. + +try { + $result = $apiInstance->trackCustomEventClientSide($origin, $client_events_create_request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClientSideApi->trackCustomEventClientSide: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **origin** | **string**| Indicates the origin (scheme, hostname, and port). | | +| **client_events_create_request_body** | [**\OpenAPI\Client\Model\ClientEventsCreateRequestBody**](../Model/ClientEventsCreateRequestBody.md)| Specify the details of the custom event. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ClientEventsCreateResponseBody**](../Model/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` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateCustomersConsentsClientSide()` + +```php +updateCustomersConsentsClientSide($customer_id, $body) +``` + +Update Customer's consents (client-side) + +Update marketing permissions for the specified customer. + +### Example + +```php +setApiKey('X-Client-Application-Id', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Client-Application-Id', 'Bearer'); + +// Configure API key authorization: X-Client-Token +$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-Client-Token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Client-Token', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\ClientSideApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$customer_id = 'customer_id_example'; // string | A Voucherify customer identifier or `source_id` +$body = {"cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I":true,"cnst_VCmucIvAsmDYw2PPAok6bcYy":false}; // object | Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use \"unsubscribed\" as a consent identifier and \"true\" as its value. #### Examples ```json { \"cnst_aIdUulAh0SCsOCaS3005y7yS\": true, \"cnst_aIdUulAhwewqaS31213fdsfds\": false } ``` Opt-out from all communication: ```json { \"unsubscribed\": true } ``` + +try { + $apiInstance->updateCustomersConsentsClientSide($customer_id, $body); +} catch (Exception $e) { + echo 'Exception when calling ClientSideApi->updateCustomersConsentsClientSide: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **customer_id** | **string**| A Voucherify customer identifier or `source_id` | | +| **body** | **object**| Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use \"unsubscribed\" as a consent identifier and \"true\" as its value. #### Examples <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"cnst_aIdUulAh0SCsOCaS3005y7yS\": true, \"cnst_aIdUulAhwewqaS31213fdsfds\": false } ``` Opt-out from all communication: <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"unsubscribed\": true } ``` | [optional] | + +### Return type + +void (empty response body) + +### 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**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `validateStackedDiscountsClientSide()` + +```php +validateStackedDiscountsClientSide($origin, $client_validations_validate_request_body): \OpenAPI\Client\Model\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. + +### Example + +```php +setApiKey('X-Client-Application-Id', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Client-Application-Id', 'Bearer'); + +// Configure API key authorization: X-Client-Token +$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-Client-Token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Client-Token', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\ClientSideApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$origin = 'origin_example'; // string | 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"}}}; // \OpenAPI\Client\Model\ClientValidationsValidateRequestBody + +try { + $result = $apiInstance->validateStackedDiscountsClientSide($origin, $client_validations_validate_request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ClientSideApi->validateStackedDiscountsClientSide: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **origin** | **string**| Indicates the origin (scheme, hostname, and port). | | +| **client_validations_validate_request_body** | [**\OpenAPI\Client\Model\ClientValidationsValidateRequestBody**](../Model/ClientValidationsValidateRequestBody.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ClientValidationsValidateResponseBody**](../Model/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` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/CustomersApi.md b/docs/Api/CustomersApi.md index 3034b51..c12504b 100644 --- a/docs/Api/CustomersApi.md +++ b/docs/Api/CustomersApi.md @@ -14,7 +14,6 @@ All URIs are relative to https://api.voucherify.io, except if the operation defi | [**listCustomers()**](CustomersApi.md#listCustomers) | **GET** /v1/customers | List Customers | | [**updateCustomer()**](CustomersApi.md#updateCustomer) | **PUT** /v1/customers/{customerId} | Update Customer | | [**updateCustomersConsents()**](CustomersApi.md#updateCustomersConsents) | **PUT** /v1/customers/{customerId}/consents | Update Customer's consents | -| [**updateCustomersConsentsClientSide()**](CustomersApi.md#updateCustomersConsentsClientSide) | **PUT** /client/v1/customers/{customerId}/consents | Update Customer's consents (client-side) | | [**updateCustomersInBulk()**](CustomersApi.md#updateCustomersInBulk) | **POST** /v1/customers/bulk/async | Update Customers in bulk | | [**updateCustomersMetadataInBulk()**](CustomersApi.md#updateCustomersMetadataInBulk) | **POST** /v1/customers/metadata/async | Update Customers' Metadata in bulk | @@ -731,74 +730,6 @@ void (empty response body) [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) -## `updateCustomersConsentsClientSide()` - -```php -updateCustomersConsentsClientSide($customer_id, $body) -``` - -Update Customer's consents (client-side) - -Update marketing permissions for the specified customer. - -### Example - -```php -setApiKey('X-Client-Application-Id', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Client-Application-Id', 'Bearer'); - -// Configure API key authorization: X-Client-Token -$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-Client-Token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Client-Token', 'Bearer'); - - -$apiInstance = new OpenAPI\Client\Api\CustomersApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$customer_id = 'customer_id_example'; // string | A Voucherify customer identifier or `source_id` -$body = {"cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I":true,"cnst_VCmucIvAsmDYw2PPAok6bcYy":false}; // object | Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use \"unsubscribed\" as a consent identifier and \"true\" as its value. #### Examples ```json { \"cnst_aIdUulAh0SCsOCaS3005y7yS\": true, \"cnst_aIdUulAhwewqaS31213fdsfds\": false } ``` Opt-out from all communication: ```json { \"unsubscribed\": true } ``` - -try { - $apiInstance->updateCustomersConsentsClientSide($customer_id, $body); -} catch (Exception $e) { - echo 'Exception when calling CustomersApi->updateCustomersConsentsClientSide: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **customer_id** | **string**| A Voucherify customer identifier or `source_id` | | -| **body** | **object**| Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use \"unsubscribed\" as a consent identifier and \"true\" as its value. #### Examples <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"cnst_aIdUulAh0SCsOCaS3005y7yS\": true, \"cnst_aIdUulAhwewqaS31213fdsfds\": false } ``` Opt-out from all communication: <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"unsubscribed\": true } ``` | [optional] | - -### Return type - -void (empty response body) - -### 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**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - ## `updateCustomersInBulk()` ```php diff --git a/docs/Api/EventsApi.md b/docs/Api/EventsApi.md index 7fba501..71b441b 100644 --- a/docs/Api/EventsApi.md +++ b/docs/Api/EventsApi.md @@ -5,7 +5,6 @@ All URIs are relative to https://api.voucherify.io, except if the operation defi | Method | HTTP request | Description | | ------------- | ------------- | ------------- | | [**trackCustomEvent()**](EventsApi.md#trackCustomEvent) | **POST** /v1/events | Track Custom Event | -| [**trackCustomEventClientSide()**](EventsApi.md#trackCustomEventClientSide) | **POST** /client/v1/events | Track Custom Event (client-side) | ## `trackCustomEvent()` @@ -74,72 +73,3 @@ try { [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) - -## `trackCustomEventClientSide()` - -```php -trackCustomEventClientSide($origin, $client_events_create_request_body): \OpenAPI\Client\Model\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 doesn't exist in Voucherify, the customer will be created. - -### Example - -```php -setApiKey('X-Client-Application-Id', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Client-Application-Id', 'Bearer'); - -// Configure API key authorization: X-Client-Token -$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-Client-Token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Client-Token', 'Bearer'); - - -$apiInstance = new OpenAPI\Client\Api\EventsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$origin = 'origin_example'; // string | 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}}; // \OpenAPI\Client\Model\ClientEventsCreateRequestBody | Specify the details of the custom event. - -try { - $result = $apiInstance->trackCustomEventClientSide($origin, $client_events_create_request_body); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling EventsApi->trackCustomEventClientSide: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **origin** | **string**| Indicates the origin (scheme, hostname, and port). | | -| **client_events_create_request_body** | [**\OpenAPI\Client\Model\ClientEventsCreateRequestBody**](../Model/ClientEventsCreateRequestBody.md)| Specify the details of the custom event. | [optional] | - -### Return type - -[**\OpenAPI\Client\Model\ClientEventsCreateResponseBody**](../Model/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` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) diff --git a/docs/Api/QualificationsApi.md b/docs/Api/QualificationsApi.md index 1ecadcb..e83cae7 100644 --- a/docs/Api/QualificationsApi.md +++ b/docs/Api/QualificationsApi.md @@ -5,7 +5,6 @@ All URIs are relative to https://api.voucherify.io, except if the operation defi | Method | HTTP request | Description | | ------------- | ------------- | ------------- | | [**checkEligibility()**](QualificationsApi.md#checkEligibility) | **POST** /v1/qualifications | Check Eligibility | -| [**checkEligibilityClientSide()**](QualificationsApi.md#checkEligibilityClientSide) | **POST** /client/v1/qualifications | Check Eligibility (client-side) | ## `checkEligibility()` @@ -74,70 +73,3 @@ try { [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) - -## `checkEligibilityClientSide()` - -```php -checkEligibilityClientSide($client_qualifications_check_eligibility_request_body): \OpenAPI\Client\Model\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](ref:examine-campaigns-qualification), [Voucher Qualifications](ref:examine-vouchers-qualification), and [Promotions Validation](ref:validate-promotions) 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](doc:checking-eligibility). ## 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 parameter's 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 - -```php -setApiKey('X-Client-Application-Id', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Client-Application-Id', 'Bearer'); - -// Configure API key authorization: X-Client-Token -$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-Client-Token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Client-Token', 'Bearer'); - - -$apiInstance = new OpenAPI\Client\Api\QualificationsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$client_qualifications_check_eligibility_request_body = new \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBody(); // \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBody | Define order and customer context. - -try { - $result = $apiInstance->checkEligibilityClientSide($client_qualifications_check_eligibility_request_body); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling QualificationsApi->checkEligibilityClientSide: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **client_qualifications_check_eligibility_request_body** | [**\OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBody**](../Model/ClientQualificationsCheckEligibilityRequestBody.md)| Define order and customer context. | [optional] | - -### Return type - -[**\OpenAPI\Client\Model\ClientQualificationsCheckEligibilityResponseBody**](../Model/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` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) diff --git a/docs/Api/RedemptionsApi.md b/docs/Api/RedemptionsApi.md index d6d208a..c2d8cbe 100644 --- a/docs/Api/RedemptionsApi.md +++ b/docs/Api/RedemptionsApi.md @@ -7,7 +7,9 @@ All URIs are relative to https://api.voucherify.io, except if the operation defi | [**getRedemption()**](RedemptionsApi.md#getRedemption) | **GET** /v1/redemptions/{redemptionId} | Get Redemption | | [**getVoucherRedemptions()**](RedemptionsApi.md#getVoucherRedemptions) | **GET** /v1/vouchers/{code}/redemption | Get Voucher's Redemptions | | [**listRedemptions()**](RedemptionsApi.md#listRedemptions) | **GET** /v1/redemptions | List Redemptions | +| [**redeemStackedDiscounts()**](RedemptionsApi.md#redeemStackedDiscounts) | **POST** /v1/redemptions | Redeem Stackable Discounts | | [**rollbackRedemption()**](RedemptionsApi.md#rollbackRedemption) | **POST** /v1/redemptions/{redemptionId}/rollback | Rollback Redemption | +| [**rollbackStackedRedemptions()**](RedemptionsApi.md#rollbackStackedRedemptions) | **POST** /v1/redemptions/{parentRedemptionId}/rollbacks | Rollback Stackable Redemptions | ## `getRedemption()` @@ -225,6 +227,73 @@ try { [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) +## `redeemStackedDiscounts()` + +```php +redeemStackedDiscounts($redemptions_redeem_request_body): \OpenAPI\Client\Model\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: | **Field** | **Calculation** | **Description** | |:---|:---|:---| | amount | N/A | This field shows the order amount before applying any discount | | total_amount | `total_amount` = `amount` - `total_discount_amount` | This field shows the order amount after applying all the discounts | | discount_amount | `discount_amount` = `previous_discount_amount` + `applied_discount_amount` | This field sums up all order-level discounts up to and including the specific discount being calculated for the stacked redemption. | | items_discount_amount | sum(items, i => i.discount_amount) | This field sums up all product-specific discounts | | total_discount_amount | `total_discount_amount` = `discount_amount` + `items_discount_amount` | This field sums up all order-level and all product-specific discounts | | applied_discount_amount | N/A | This field shows the order-level discount applied in a particular request | | items_applied_discount_amount | sum(items, i => i.applied_discount_amount) | This field sums up all product-specific discounts applied in a particular request | | total_applied_discount_amount | `total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount` | This field sums up all order-level and all product-specific discounts applied in a particular request | > 📘 Rollbacks > > You can't 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](ref:rollback-stacked-redemptions). > 📘 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](ref:redeem-stacked-discounts-client-side) 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 + +```php +setApiKey('X-App-Id', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Id', 'Bearer'); + +// Configure API key authorization: X-App-Token +$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-App-Token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Token', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\RedemptionsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$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"}}}; // \OpenAPI\Client\Model\RedemptionsRedeemRequestBody + +try { + $result = $apiInstance->redeemStackedDiscounts($redemptions_redeem_request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RedemptionsApi->redeemStackedDiscounts: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **redemptions_redeem_request_body** | [**\OpenAPI\Client\Model\RedemptionsRedeemRequestBody**](../Model/RedemptionsRedeemRequestBody.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\RedemptionsRedeemResponseBody**](../Model/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` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + ## `rollbackRedemption()` ```php @@ -297,3 +366,76 @@ try { [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) + +## `rollbackStackedRedemptions()` + +```php +rollbackStackedRedemptions($parent_redemption_id, $reason, $tracking_id, $redemptions_rollbacks_create_request_body): \OpenAPI\Client\Model\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. + +### Example + +```php +setApiKey('X-App-Id', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Id', 'Bearer'); + +// Configure API key authorization: X-App-Token +$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-App-Token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Token', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\RedemptionsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$parent_redemption_id = 'parent_redemption_id_example'; // string | Unique identifier of a parent redemption, e.g. `r_JQfm73zWSJFQxs3bGxweYjgm`. +$reason = 'reason_example'; // string | Reason for the rollback. +$tracking_id = 'tracking_id_example'; // string | Customer's `source_id`. +$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"]}}; // \OpenAPI\Client\Model\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. + +try { + $result = $apiInstance->rollbackStackedRedemptions($parent_redemption_id, $reason, $tracking_id, $redemptions_rollbacks_create_request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling RedemptionsApi->rollbackStackedRedemptions: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **parent_redemption_id** | **string**| Unique identifier of a parent redemption, e.g. `r_JQfm73zWSJFQxs3bGxweYjgm`. | | +| **reason** | **string**| Reason for the rollback. | [optional] | +| **tracking_id** | **string**| Customer's `source_id`. | [optional] | +| **redemptions_rollbacks_create_request_body** | [**\OpenAPI\Client\Model\RedemptionsRollbacksCreateRequestBody**](../Model/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 + +[**\OpenAPI\Client\Model\RedemptionsRollbacksCreateResponseBody**](../Model/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` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/ValidationsApi.md b/docs/Api/ValidationsApi.md new file mode 100644 index 0000000..a440698 --- /dev/null +++ b/docs/Api/ValidationsApi.md @@ -0,0 +1,75 @@ +# OpenAPI\Client\ValidationsApi + +All URIs are relative to https://api.voucherify.io, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**validateStackedDiscounts()**](ValidationsApi.md#validateStackedDiscounts) | **POST** /v1/validations | Validate Stackable Discounts | + + +## `validateStackedDiscounts()` + +```php +validateStackedDiscounts($validations_validate_request_body): \OpenAPI\Client\Model\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. + +### Example + +```php +setApiKey('X-App-Id', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Id', 'Bearer'); + +// Configure API key authorization: X-App-Token +$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-App-Token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Token', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\ValidationsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$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"}}}; // \OpenAPI\Client\Model\ValidationsValidateRequestBody + +try { + $result = $apiInstance->validateStackedDiscounts($validations_validate_request_body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ValidationsApi->validateStackedDiscounts: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **validations_validate_request_body** | [**\OpenAPI\Client\Model\ValidationsValidateRequestBody**](../Model/ValidationsValidateRequestBody.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\ValidationsValidateResponseBody**](../Model/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` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Model/ClientValidationsValidateResponseBody.md b/docs/Model/ClientValidationsValidateResponseBody.md index 7f1d62d..39950d4 100644 --- a/docs/Model/ClientValidationsValidateResponseBody.md +++ b/docs/Model/ClientValidationsValidateResponseBody.md @@ -11,6 +11,5 @@ Name | Type | Description | Notes **order** | [**\OpenAPI\Client\Model\OrderCalculated**](OrderCalculated.md) | | [optional] **tracking_id** | **string** | Hashed customer source ID. | [optional] **session** | [**\OpenAPI\Client\Model\Session**](Session.md) | | [optional] -**stacking_rules** | [**\OpenAPI\Client\Model\StackingRules**](StackingRules.md) | | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/QualificationsOptionFilters.md b/docs/Model/QualificationsOptionFilters.md index ac0abd3..68199c2 100644 --- a/docs/Model/QualificationsOptionFilters.md +++ b/docs/Model/QualificationsOptionFilters.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes **category_id** | [**\OpenAPI\Client\Model\QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] **campaign_id** | [**\OpenAPI\Client\Model\QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] **resource_id** | [**\OpenAPI\Client\Model\QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] -**resource_type** | [**\OpenAPI\Client\Model\QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] +**resource_type** | [**\OpenAPI\Client\Model\QualificationsOptionFiltersResourceType**](QualificationsOptionFiltersResourceType.md) | | [optional] **voucher_type** | [**\OpenAPI\Client\Model\QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] **code** | [**\OpenAPI\Client\Model\QualificationsFieldConditions**](QualificationsFieldConditions.md) | | [optional] diff --git a/docs/Model/QualificationsOptionFiltersResourceType.md b/docs/Model/QualificationsOptionFiltersResourceType.md new file mode 100644 index 0000000..d0afd24 --- /dev/null +++ b/docs/Model/QualificationsOptionFiltersResourceType.md @@ -0,0 +1,9 @@ +# # QualificationsOptionFiltersResourceType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**conditions** | [**\OpenAPI\Client\Model\QualificationsOptionFiltersResourceTypeConditions**](QualificationsOptionFiltersResourceTypeConditions.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/QualificationsOptionFiltersResourceTypeConditions.md b/docs/Model/QualificationsOptionFiltersResourceTypeConditions.md new file mode 100644 index 0000000..3d97f59 --- /dev/null +++ b/docs/Model/QualificationsOptionFiltersResourceTypeConditions.md @@ -0,0 +1,12 @@ +# # QualificationsOptionFiltersResourceTypeConditions + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**is** | **string** | Types of usable resources. | [optional] +**is_not** | **string** | Types of usable resources. | [optional] +**in** | **string[]** | Array of qualified redeemables. Accepts more than one value. Returns the resource types entered in the array. | [optional] +**not_in** | **string[]** | Array of qualified redeemables. Accepts more than one value. Returns the resource types except those entered in the array. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidationsValidateResponseBody.md b/docs/Model/ValidationsValidateResponseBody.md index 58d9e71..b7ae87f 100644 --- a/docs/Model/ValidationsValidateResponseBody.md +++ b/docs/Model/ValidationsValidateResponseBody.md @@ -11,6 +11,5 @@ Name | Type | Description | Notes **order** | [**\OpenAPI\Client\Model\OrderCalculated**](OrderCalculated.md) | | [optional] **tracking_id** | **string** | Hashed customer source ID. | [optional] **session** | [**\OpenAPI\Client\Model\Session**](Session.md) | | [optional] -**stacking_rules** | [**\OpenAPI\Client\Model\StackingRules**](StackingRules.md) | | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/src/Api/StackableDiscountsApi.php b/src/Api/ClientSideApi.php similarity index 74% rename from src/Api/StackableDiscountsApi.php rename to src/Api/ClientSideApi.php index 3d77816..3a75dd1 100644 --- a/src/Api/StackableDiscountsApi.php +++ b/src/Api/ClientSideApi.php @@ -1,6 +1,6 @@ [ + 'checkEligibilityClientSide' => [ 'application/json', ], 'redeemStackedDiscountsClientSide' => [ 'application/json', ], - 'rollbackStackedRedemptions' => [ + 'trackCustomEventClientSide' => [ 'application/json', ], - 'validateStackedDiscounts' => [ + 'updateCustomersConsentsClientSide' => [ 'application/json', ], 'validateStackedDiscountsClientSide' => [ @@ -136,38 +136,38 @@ public function getConfig() } /** - * Operation redeemStackedDiscounts + * Operation checkEligibilityClientSide * - * Redeem Stackable Discounts + * Check Eligibility (client-side) * - * @param \OpenAPI\Client\Model\RedemptionsRedeemRequestBody $redemptions_redeem_request_body redemptions_redeem_request_body (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemStackedDiscounts'] to see the possible values for this operation + * @param \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBody $client_qualifications_check_eligibility_request_body Define order and customer context. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEligibilityClientSide'] to see the possible values for this operation * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \OpenAPI\Client\Model\RedemptionsRedeemResponseBody + * @return \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityResponseBody */ - public function redeemStackedDiscounts($redemptions_redeem_request_body = null, string $contentType = self::contentTypes['redeemStackedDiscounts'][0]) + public function checkEligibilityClientSide($client_qualifications_check_eligibility_request_body = null, string $contentType = self::contentTypes['checkEligibilityClientSide'][0]) { - list($response) = $this->redeemStackedDiscountsWithHttpInfo($redemptions_redeem_request_body, $contentType); + list($response) = $this->checkEligibilityClientSideWithHttpInfo($client_qualifications_check_eligibility_request_body, $contentType); return $response; } /** - * Operation redeemStackedDiscountsWithHttpInfo + * Operation checkEligibilityClientSideWithHttpInfo * - * Redeem Stackable Discounts + * Check Eligibility (client-side) * - * @param \OpenAPI\Client\Model\RedemptionsRedeemRequestBody $redemptions_redeem_request_body (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemStackedDiscounts'] to see the possible values for this operation + * @param \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBody $client_qualifications_check_eligibility_request_body Define order and customer context. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEligibilityClientSide'] to see the possible values for this operation * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\RedemptionsRedeemResponseBody, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityResponseBody, HTTP status code, HTTP response headers (array of strings) */ - public function redeemStackedDiscountsWithHttpInfo($redemptions_redeem_request_body = null, string $contentType = self::contentTypes['redeemStackedDiscounts'][0]) + public function checkEligibilityClientSideWithHttpInfo($client_qualifications_check_eligibility_request_body = null, string $contentType = self::contentTypes['checkEligibilityClientSide'][0]) { - $request = $this->redeemStackedDiscountsRequest($redemptions_redeem_request_body, $contentType); + $request = $this->checkEligibilityClientSideRequest($client_qualifications_check_eligibility_request_body, $contentType); try { $options = $this->createHttpClientOption(); @@ -206,23 +206,23 @@ public function redeemStackedDiscountsWithHttpInfo($redemptions_redeem_request_b switch($statusCode) { case 200: - if ('\OpenAPI\Client\Model\RedemptionsRedeemResponseBody' === '\SplFileObject') { + if ('\OpenAPI\Client\Model\ClientQualificationsCheckEligibilityResponseBody' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\OpenAPI\Client\Model\RedemptionsRedeemResponseBody' !== 'string') { + if ('\OpenAPI\Client\Model\ClientQualificationsCheckEligibilityResponseBody' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\RedemptionsRedeemResponseBody', []), + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ClientQualificationsCheckEligibilityResponseBody', []), $response->getStatusCode(), $response->getHeaders() ]; } - $returnType = '\OpenAPI\Client\Model\RedemptionsRedeemResponseBody'; + $returnType = '\OpenAPI\Client\Model\ClientQualificationsCheckEligibilityResponseBody'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -243,7 +243,7 @@ public function redeemStackedDiscountsWithHttpInfo($redemptions_redeem_request_b case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\OpenAPI\Client\Model\RedemptionsRedeemResponseBody', + '\OpenAPI\Client\Model\ClientQualificationsCheckEligibilityResponseBody', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -254,19 +254,19 @@ public function redeemStackedDiscountsWithHttpInfo($redemptions_redeem_request_b } /** - * Operation redeemStackedDiscountsAsync + * Operation checkEligibilityClientSideAsync * - * Redeem Stackable Discounts + * Check Eligibility (client-side) * - * @param \OpenAPI\Client\Model\RedemptionsRedeemRequestBody $redemptions_redeem_request_body (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemStackedDiscounts'] to see the possible values for this operation + * @param \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBody $client_qualifications_check_eligibility_request_body Define order and customer context. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEligibilityClientSide'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function redeemStackedDiscountsAsync($redemptions_redeem_request_body = null, string $contentType = self::contentTypes['redeemStackedDiscounts'][0]) + public function checkEligibilityClientSideAsync($client_qualifications_check_eligibility_request_body = null, string $contentType = self::contentTypes['checkEligibilityClientSide'][0]) { - return $this->redeemStackedDiscountsAsyncWithHttpInfo($redemptions_redeem_request_body, $contentType) + return $this->checkEligibilityClientSideAsyncWithHttpInfo($client_qualifications_check_eligibility_request_body, $contentType) ->then( function ($response) { return $response[0]; @@ -275,20 +275,20 @@ function ($response) { } /** - * Operation redeemStackedDiscountsAsyncWithHttpInfo + * Operation checkEligibilityClientSideAsyncWithHttpInfo * - * Redeem Stackable Discounts + * Check Eligibility (client-side) * - * @param \OpenAPI\Client\Model\RedemptionsRedeemRequestBody $redemptions_redeem_request_body (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemStackedDiscounts'] to see the possible values for this operation + * @param \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBody $client_qualifications_check_eligibility_request_body Define order and customer context. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEligibilityClientSide'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function redeemStackedDiscountsAsyncWithHttpInfo($redemptions_redeem_request_body = null, string $contentType = self::contentTypes['redeemStackedDiscounts'][0]) + public function checkEligibilityClientSideAsyncWithHttpInfo($client_qualifications_check_eligibility_request_body = null, string $contentType = self::contentTypes['checkEligibilityClientSide'][0]) { - $returnType = '\OpenAPI\Client\Model\RedemptionsRedeemResponseBody'; - $request = $this->redeemStackedDiscountsRequest($redemptions_redeem_request_body, $contentType); + $returnType = '\OpenAPI\Client\Model\ClientQualificationsCheckEligibilityResponseBody'; + $request = $this->checkEligibilityClientSideRequest($client_qualifications_check_eligibility_request_body, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -327,20 +327,20 @@ function ($exception) { } /** - * Create request for operation 'redeemStackedDiscounts' + * Create request for operation 'checkEligibilityClientSide' * - * @param \OpenAPI\Client\Model\RedemptionsRedeemRequestBody $redemptions_redeem_request_body (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemStackedDiscounts'] to see the possible values for this operation + * @param \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBody $client_qualifications_check_eligibility_request_body Define order and customer context. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEligibilityClientSide'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function redeemStackedDiscountsRequest($redemptions_redeem_request_body = null, string $contentType = self::contentTypes['redeemStackedDiscounts'][0]) + public function checkEligibilityClientSideRequest($client_qualifications_check_eligibility_request_body = null, string $contentType = self::contentTypes['checkEligibilityClientSide'][0]) { - $resourcePath = '/v1/redemptions'; + $resourcePath = '/client/v1/qualifications'; $formParams = []; $queryParams = []; $headerParams = []; @@ -358,12 +358,12 @@ public function redeemStackedDiscountsRequest($redemptions_redeem_request_body = ); // for model (json/xml) - if (isset($redemptions_redeem_request_body)) { + if (isset($client_qualifications_check_eligibility_request_body)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($redemptions_redeem_request_body)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($client_qualifications_check_eligibility_request_body)); } else { - $httpBody = $redemptions_redeem_request_body; + $httpBody = $client_qualifications_check_eligibility_request_body; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -390,14 +390,14 @@ public function redeemStackedDiscountsRequest($redemptions_redeem_request_body = } // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('X-App-Id'); + $apiKey = $this->config->getApiKeyWithPrefix('X-Client-Application-Id'); if ($apiKey !== null) { - $headers['X-App-Id'] = $apiKey; + $headers['X-Client-Application-Id'] = $apiKey; } // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('X-App-Token'); + $apiKey = $this->config->getApiKeyWithPrefix('X-Client-Token'); if ($apiKey !== null) { - $headers['X-App-Token'] = $apiKey; + $headers['X-Client-Token'] = $apiKey; } $defaultHeaders = []; @@ -724,44 +724,40 @@ public function redeemStackedDiscountsClientSideRequest($origin, $client_redempt } /** - * Operation rollbackStackedRedemptions + * Operation trackCustomEventClientSide * - * Rollback Stackable Redemptions + * Track Custom Event (client-side) * - * @param string $parent_redemption_id Unique identifier of a parent redemption, e.g. `r_JQfm73zWSJFQxs3bGxweYjgm`. (required) - * @param string $reason Reason for the rollback. (optional) - * @param string $tracking_id Customer's `source_id`. (optional) - * @param \OpenAPI\Client\Model\RedemptionsRollbacksCreateRequestBody $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. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rollbackStackedRedemptions'] to see the possible values for this operation + * @param string $origin Indicates the origin (scheme, hostname, and port). (required) + * @param \OpenAPI\Client\Model\ClientEventsCreateRequestBody $client_events_create_request_body Specify the details of the custom event. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackCustomEventClientSide'] to see the possible values for this operation * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \OpenAPI\Client\Model\RedemptionsRollbacksCreateResponseBody + * @return \OpenAPI\Client\Model\ClientEventsCreateResponseBody */ - public function rollbackStackedRedemptions($parent_redemption_id, $reason = null, $tracking_id = null, $redemptions_rollbacks_create_request_body = null, string $contentType = self::contentTypes['rollbackStackedRedemptions'][0]) + public function trackCustomEventClientSide($origin, $client_events_create_request_body = null, string $contentType = self::contentTypes['trackCustomEventClientSide'][0]) { - list($response) = $this->rollbackStackedRedemptionsWithHttpInfo($parent_redemption_id, $reason, $tracking_id, $redemptions_rollbacks_create_request_body, $contentType); + list($response) = $this->trackCustomEventClientSideWithHttpInfo($origin, $client_events_create_request_body, $contentType); return $response; } /** - * Operation rollbackStackedRedemptionsWithHttpInfo + * Operation trackCustomEventClientSideWithHttpInfo * - * Rollback Stackable Redemptions + * Track Custom Event (client-side) * - * @param string $parent_redemption_id Unique identifier of a parent redemption, e.g. `r_JQfm73zWSJFQxs3bGxweYjgm`. (required) - * @param string $reason Reason for the rollback. (optional) - * @param string $tracking_id Customer's `source_id`. (optional) - * @param \OpenAPI\Client\Model\RedemptionsRollbacksCreateRequestBody $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. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rollbackStackedRedemptions'] to see the possible values for this operation + * @param string $origin Indicates the origin (scheme, hostname, and port). (required) + * @param \OpenAPI\Client\Model\ClientEventsCreateRequestBody $client_events_create_request_body Specify the details of the custom event. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackCustomEventClientSide'] to see the possible values for this operation * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\RedemptionsRollbacksCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + * @return array of \OpenAPI\Client\Model\ClientEventsCreateResponseBody, HTTP status code, HTTP response headers (array of strings) */ - public function rollbackStackedRedemptionsWithHttpInfo($parent_redemption_id, $reason = null, $tracking_id = null, $redemptions_rollbacks_create_request_body = null, string $contentType = self::contentTypes['rollbackStackedRedemptions'][0]) + public function trackCustomEventClientSideWithHttpInfo($origin, $client_events_create_request_body = null, string $contentType = self::contentTypes['trackCustomEventClientSide'][0]) { - $request = $this->rollbackStackedRedemptionsRequest($parent_redemption_id, $reason, $tracking_id, $redemptions_rollbacks_create_request_body, $contentType); + $request = $this->trackCustomEventClientSideRequest($origin, $client_events_create_request_body, $contentType); try { $options = $this->createHttpClientOption(); @@ -800,23 +796,23 @@ public function rollbackStackedRedemptionsWithHttpInfo($parent_redemption_id, $r switch($statusCode) { case 200: - if ('\OpenAPI\Client\Model\RedemptionsRollbacksCreateResponseBody' === '\SplFileObject') { + if ('\OpenAPI\Client\Model\ClientEventsCreateResponseBody' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\OpenAPI\Client\Model\RedemptionsRollbacksCreateResponseBody' !== 'string') { + if ('\OpenAPI\Client\Model\ClientEventsCreateResponseBody' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\RedemptionsRollbacksCreateResponseBody', []), + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ClientEventsCreateResponseBody', []), $response->getStatusCode(), $response->getHeaders() ]; } - $returnType = '\OpenAPI\Client\Model\RedemptionsRollbacksCreateResponseBody'; + $returnType = '\OpenAPI\Client\Model\ClientEventsCreateResponseBody'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -837,7 +833,7 @@ public function rollbackStackedRedemptionsWithHttpInfo($parent_redemption_id, $r case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\OpenAPI\Client\Model\RedemptionsRollbacksCreateResponseBody', + '\OpenAPI\Client\Model\ClientEventsCreateResponseBody', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -848,22 +844,20 @@ public function rollbackStackedRedemptionsWithHttpInfo($parent_redemption_id, $r } /** - * Operation rollbackStackedRedemptionsAsync + * Operation trackCustomEventClientSideAsync * - * Rollback Stackable Redemptions + * Track Custom Event (client-side) * - * @param string $parent_redemption_id Unique identifier of a parent redemption, e.g. `r_JQfm73zWSJFQxs3bGxweYjgm`. (required) - * @param string $reason Reason for the rollback. (optional) - * @param string $tracking_id Customer's `source_id`. (optional) - * @param \OpenAPI\Client\Model\RedemptionsRollbacksCreateRequestBody $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. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rollbackStackedRedemptions'] to see the possible values for this operation + * @param string $origin Indicates the origin (scheme, hostname, and port). (required) + * @param \OpenAPI\Client\Model\ClientEventsCreateRequestBody $client_events_create_request_body Specify the details of the custom event. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackCustomEventClientSide'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function rollbackStackedRedemptionsAsync($parent_redemption_id, $reason = null, $tracking_id = null, $redemptions_rollbacks_create_request_body = null, string $contentType = self::contentTypes['rollbackStackedRedemptions'][0]) + public function trackCustomEventClientSideAsync($origin, $client_events_create_request_body = null, string $contentType = self::contentTypes['trackCustomEventClientSide'][0]) { - return $this->rollbackStackedRedemptionsAsyncWithHttpInfo($parent_redemption_id, $reason, $tracking_id, $redemptions_rollbacks_create_request_body, $contentType) + return $this->trackCustomEventClientSideAsyncWithHttpInfo($origin, $client_events_create_request_body, $contentType) ->then( function ($response) { return $response[0]; @@ -872,23 +866,21 @@ function ($response) { } /** - * Operation rollbackStackedRedemptionsAsyncWithHttpInfo + * Operation trackCustomEventClientSideAsyncWithHttpInfo * - * Rollback Stackable Redemptions + * Track Custom Event (client-side) * - * @param string $parent_redemption_id Unique identifier of a parent redemption, e.g. `r_JQfm73zWSJFQxs3bGxweYjgm`. (required) - * @param string $reason Reason for the rollback. (optional) - * @param string $tracking_id Customer's `source_id`. (optional) - * @param \OpenAPI\Client\Model\RedemptionsRollbacksCreateRequestBody $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. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rollbackStackedRedemptions'] to see the possible values for this operation + * @param string $origin Indicates the origin (scheme, hostname, and port). (required) + * @param \OpenAPI\Client\Model\ClientEventsCreateRequestBody $client_events_create_request_body Specify the details of the custom event. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackCustomEventClientSide'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function rollbackStackedRedemptionsAsyncWithHttpInfo($parent_redemption_id, $reason = null, $tracking_id = null, $redemptions_rollbacks_create_request_body = null, string $contentType = self::contentTypes['rollbackStackedRedemptions'][0]) + public function trackCustomEventClientSideAsyncWithHttpInfo($origin, $client_events_create_request_body = null, string $contentType = self::contentTypes['trackCustomEventClientSide'][0]) { - $returnType = '\OpenAPI\Client\Model\RedemptionsRollbacksCreateResponseBody'; - $request = $this->rollbackStackedRedemptionsRequest($parent_redemption_id, $reason, $tracking_id, $redemptions_rollbacks_create_request_body, $contentType); + $returnType = '\OpenAPI\Client\Model\ClientEventsCreateResponseBody'; + $request = $this->trackCustomEventClientSideRequest($origin, $client_events_create_request_body, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -927,68 +919,42 @@ function ($exception) { } /** - * Create request for operation 'rollbackStackedRedemptions' + * Create request for operation 'trackCustomEventClientSide' * - * @param string $parent_redemption_id Unique identifier of a parent redemption, e.g. `r_JQfm73zWSJFQxs3bGxweYjgm`. (required) - * @param string $reason Reason for the rollback. (optional) - * @param string $tracking_id Customer's `source_id`. (optional) - * @param \OpenAPI\Client\Model\RedemptionsRollbacksCreateRequestBody $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. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rollbackStackedRedemptions'] to see the possible values for this operation + * @param string $origin Indicates the origin (scheme, hostname, and port). (required) + * @param \OpenAPI\Client\Model\ClientEventsCreateRequestBody $client_events_create_request_body Specify the details of the custom event. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackCustomEventClientSide'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function rollbackStackedRedemptionsRequest($parent_redemption_id, $reason = null, $tracking_id = null, $redemptions_rollbacks_create_request_body = null, string $contentType = self::contentTypes['rollbackStackedRedemptions'][0]) + public function trackCustomEventClientSideRequest($origin, $client_events_create_request_body = null, string $contentType = self::contentTypes['trackCustomEventClientSide'][0]) { - // verify the required parameter 'parent_redemption_id' is set - if ($parent_redemption_id === null || (is_array($parent_redemption_id) && count($parent_redemption_id) === 0)) { + // verify the required parameter 'origin' is set + if ($origin === null || (is_array($origin) && count($origin) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $parent_redemption_id when calling rollbackStackedRedemptions' + 'Missing the required parameter $origin when calling trackCustomEventClientSide' ); } - - - $resourcePath = '/v1/redemptions/{parentRedemptionId}/rollbacks'; + $resourcePath = '/client/v1/events'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $reason, - 'reason', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $tracking_id, - 'tracking_id', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - - // path params - if ($parent_redemption_id !== null) { - $resourcePath = str_replace( - '{' . 'parentRedemptionId' . '}', - ObjectSerializer::toPathValue($parent_redemption_id), - $resourcePath - ); + // header params + if ($origin !== null) { + $headerParams['origin'] = ObjectSerializer::toHeaderValue($origin); } + $headers = $this->headerSelector->selectHeaders( ['application/json', ], $contentType, @@ -996,12 +962,12 @@ public function rollbackStackedRedemptionsRequest($parent_redemption_id, $reason ); // for model (json/xml) - if (isset($redemptions_rollbacks_create_request_body)) { + if (isset($client_events_create_request_body)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($redemptions_rollbacks_create_request_body)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($client_events_create_request_body)); } else { - $httpBody = $redemptions_rollbacks_create_request_body; + $httpBody = $client_events_create_request_body; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1028,14 +994,14 @@ public function rollbackStackedRedemptionsRequest($parent_redemption_id, $reason } // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('X-App-Id'); + $apiKey = $this->config->getApiKeyWithPrefix('X-Client-Application-Id'); if ($apiKey !== null) { - $headers['X-App-Id'] = $apiKey; + $headers['X-Client-Application-Id'] = $apiKey; } // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('X-App-Token'); + $apiKey = $this->config->getApiKeyWithPrefix('X-Client-Token'); if ($apiKey !== null) { - $headers['X-App-Token'] = $apiKey; + $headers['X-Client-Token'] = $apiKey; } $defaultHeaders = []; @@ -1060,38 +1026,39 @@ public function rollbackStackedRedemptionsRequest($parent_redemption_id, $reason } /** - * Operation validateStackedDiscounts + * Operation updateCustomersConsentsClientSide * - * Validate Stackable Discounts + * Update Customer's consents (client-side) * - * @param \OpenAPI\Client\Model\ValidationsValidateRequestBody $validations_validate_request_body validations_validate_request_body (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateStackedDiscounts'] to see the possible values for this operation + * @param string $customer_id A Voucherify customer identifier or `source_id` (required) + * @param object $body Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use \"unsubscribed\" as a consent identifier and \"true\" as its value. #### Examples <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"cnst_aIdUulAh0SCsOCaS3005y7yS\": true, \"cnst_aIdUulAhwewqaS31213fdsfds\": false } ``` Opt-out from all communication: <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"unsubscribed\": true } ``` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersConsentsClientSide'] to see the possible values for this operation * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \OpenAPI\Client\Model\ValidationsValidateResponseBody + * @return void */ - public function validateStackedDiscounts($validations_validate_request_body = null, string $contentType = self::contentTypes['validateStackedDiscounts'][0]) + public function updateCustomersConsentsClientSide($customer_id, $body = null, string $contentType = self::contentTypes['updateCustomersConsentsClientSide'][0]) { - list($response) = $this->validateStackedDiscountsWithHttpInfo($validations_validate_request_body, $contentType); - return $response; + $this->updateCustomersConsentsClientSideWithHttpInfo($customer_id, $body, $contentType); } /** - * Operation validateStackedDiscountsWithHttpInfo + * Operation updateCustomersConsentsClientSideWithHttpInfo * - * Validate Stackable Discounts + * Update Customer's consents (client-side) * - * @param \OpenAPI\Client\Model\ValidationsValidateRequestBody $validations_validate_request_body (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateStackedDiscounts'] to see the possible values for this operation + * @param string $customer_id A Voucherify customer identifier or `source_id` (required) + * @param object $body Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use \"unsubscribed\" as a consent identifier and \"true\" as its value. #### Examples <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"cnst_aIdUulAh0SCsOCaS3005y7yS\": true, \"cnst_aIdUulAhwewqaS31213fdsfds\": false } ``` Opt-out from all communication: <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"unsubscribed\": true } ``` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersConsentsClientSide'] to see the possible values for this operation * * @throws \OpenAPI\Client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\ValidationsValidateResponseBody, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function validateStackedDiscountsWithHttpInfo($validations_validate_request_body = null, string $contentType = self::contentTypes['validateStackedDiscounts'][0]) + public function updateCustomersConsentsClientSideWithHttpInfo($customer_id, $body = null, string $contentType = self::contentTypes['updateCustomersConsentsClientSide'][0]) { - $request = $this->validateStackedDiscountsRequest($validations_validate_request_body, $contentType); + $request = $this->updateCustomersConsentsClientSideRequest($customer_id, $body, $contentType); try { $options = $this->createHttpClientOption(); @@ -1128,69 +1095,30 @@ public function validateStackedDiscountsWithHttpInfo($validations_validate_reque ); } - switch($statusCode) { - case 200: - if ('\OpenAPI\Client\Model\ValidationsValidateResponseBody' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\OpenAPI\Client\Model\ValidationsValidateResponseBody' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ValidationsValidateResponseBody', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\OpenAPI\Client\Model\ValidationsValidateResponseBody'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return [null, $statusCode, $response->getHeaders()]; } catch (ApiException $e) { switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\OpenAPI\Client\Model\ValidationsValidateResponseBody', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; } throw $e; } } /** - * Operation validateStackedDiscountsAsync + * Operation updateCustomersConsentsClientSideAsync * - * Validate Stackable Discounts + * Update Customer's consents (client-side) * - * @param \OpenAPI\Client\Model\ValidationsValidateRequestBody $validations_validate_request_body (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateStackedDiscounts'] to see the possible values for this operation + * @param string $customer_id A Voucherify customer identifier or `source_id` (required) + * @param object $body Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use \"unsubscribed\" as a consent identifier and \"true\" as its value. #### Examples <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"cnst_aIdUulAh0SCsOCaS3005y7yS\": true, \"cnst_aIdUulAhwewqaS31213fdsfds\": false } ``` Opt-out from all communication: <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"unsubscribed\": true } ``` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersConsentsClientSide'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function validateStackedDiscountsAsync($validations_validate_request_body = null, string $contentType = self::contentTypes['validateStackedDiscounts'][0]) + public function updateCustomersConsentsClientSideAsync($customer_id, $body = null, string $contentType = self::contentTypes['updateCustomersConsentsClientSide'][0]) { - return $this->validateStackedDiscountsAsyncWithHttpInfo($validations_validate_request_body, $contentType) + return $this->updateCustomersConsentsClientSideAsyncWithHttpInfo($customer_id, $body, $contentType) ->then( function ($response) { return $response[0]; @@ -1199,39 +1127,27 @@ function ($response) { } /** - * Operation validateStackedDiscountsAsyncWithHttpInfo + * Operation updateCustomersConsentsClientSideAsyncWithHttpInfo * - * Validate Stackable Discounts + * Update Customer's consents (client-side) * - * @param \OpenAPI\Client\Model\ValidationsValidateRequestBody $validations_validate_request_body (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateStackedDiscounts'] to see the possible values for this operation + * @param string $customer_id A Voucherify customer identifier or `source_id` (required) + * @param object $body Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use \"unsubscribed\" as a consent identifier and \"true\" as its value. #### Examples <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"cnst_aIdUulAh0SCsOCaS3005y7yS\": true, \"cnst_aIdUulAhwewqaS31213fdsfds\": false } ``` Opt-out from all communication: <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"unsubscribed\": true } ``` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersConsentsClientSide'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function validateStackedDiscountsAsyncWithHttpInfo($validations_validate_request_body = null, string $contentType = self::contentTypes['validateStackedDiscounts'][0]) + public function updateCustomersConsentsClientSideAsyncWithHttpInfo($customer_id, $body = null, string $contentType = self::contentTypes['updateCustomersConsentsClientSide'][0]) { - $returnType = '\OpenAPI\Client\Model\ValidationsValidateResponseBody'; - $request = $this->validateStackedDiscountsRequest($validations_validate_request_body, $contentType); + $returnType = ''; + $request = $this->updateCustomersConsentsClientSideRequest($customer_id, $body, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { $response = $exception->getResponse(); @@ -1251,20 +1167,28 @@ function ($exception) { } /** - * Create request for operation 'validateStackedDiscounts' + * Create request for operation 'updateCustomersConsentsClientSide' * - * @param \OpenAPI\Client\Model\ValidationsValidateRequestBody $validations_validate_request_body (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateStackedDiscounts'] to see the possible values for this operation + * @param string $customer_id A Voucherify customer identifier or `source_id` (required) + * @param object $body Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use \"unsubscribed\" as a consent identifier and \"true\" as its value. #### Examples <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"cnst_aIdUulAh0SCsOCaS3005y7yS\": true, \"cnst_aIdUulAhwewqaS31213fdsfds\": false } ``` Opt-out from all communication: <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"unsubscribed\": true } ``` (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersConsentsClientSide'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function validateStackedDiscountsRequest($validations_validate_request_body = null, string $contentType = self::contentTypes['validateStackedDiscounts'][0]) + public function updateCustomersConsentsClientSideRequest($customer_id, $body = null, string $contentType = self::contentTypes['updateCustomersConsentsClientSide'][0]) { + // verify the required parameter 'customer_id' is set + if ($customer_id === null || (is_array($customer_id) && count($customer_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $customer_id when calling updateCustomersConsentsClientSide' + ); + } + - $resourcePath = '/v1/validations'; + $resourcePath = '/client/v1/customers/{customerId}/consents'; $formParams = []; $queryParams = []; $headerParams = []; @@ -1273,21 +1197,29 @@ public function validateStackedDiscountsRequest($validations_validate_request_bo + // path params + if ($customer_id !== null) { + $resourcePath = str_replace( + '{' . 'customerId' . '}', + ObjectSerializer::toPathValue($customer_id), + $resourcePath + ); + } $headers = $this->headerSelector->selectHeaders( - ['application/json', ], + [], $contentType, $multipart ); // for model (json/xml) - if (isset($validations_validate_request_body)) { + if (isset($body)) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($validations_validate_request_body)); + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); } else { - $httpBody = $validations_validate_request_body; + $httpBody = $body; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1314,14 +1246,14 @@ public function validateStackedDiscountsRequest($validations_validate_request_bo } // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('X-App-Id'); + $apiKey = $this->config->getApiKeyWithPrefix('X-Client-Application-Id'); if ($apiKey !== null) { - $headers['X-App-Id'] = $apiKey; + $headers['X-Client-Application-Id'] = $apiKey; } // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('X-App-Token'); + $apiKey = $this->config->getApiKeyWithPrefix('X-Client-Token'); if ($apiKey !== null) { - $headers['X-App-Token'] = $apiKey; + $headers['X-Client-Token'] = $apiKey; } $defaultHeaders = []; @@ -1338,7 +1270,7 @@ public function validateStackedDiscountsRequest($validations_validate_request_bo $operationHost = $this->config->getHost(); $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'PUT', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody diff --git a/src/Api/CustomersApi.php b/src/Api/CustomersApi.php index d357e4c..62defa4 100644 --- a/src/Api/CustomersApi.php +++ b/src/Api/CustomersApi.php @@ -102,9 +102,6 @@ class CustomersApi 'updateCustomersConsents' => [ 'application/json', ], - 'updateCustomersConsentsClientSide' => [ - 'application/json', - ], 'updateCustomersInBulk' => [ 'application/json', ], @@ -3314,258 +3311,6 @@ public function updateCustomersConsentsRequest($customer_id, $body = null, strin ); } - /** - * Operation updateCustomersConsentsClientSide - * - * Update Customer's consents (client-side) - * - * @param string $customer_id A Voucherify customer identifier or `source_id` (required) - * @param object $body Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use \"unsubscribed\" as a consent identifier and \"true\" as its value. #### Examples <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"cnst_aIdUulAh0SCsOCaS3005y7yS\": true, \"cnst_aIdUulAhwewqaS31213fdsfds\": false } ``` Opt-out from all communication: <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"unsubscribed\": true } ``` (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersConsentsClientSide'] to see the possible values for this operation - * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - */ - public function updateCustomersConsentsClientSide($customer_id, $body = null, string $contentType = self::contentTypes['updateCustomersConsentsClientSide'][0]) - { - $this->updateCustomersConsentsClientSideWithHttpInfo($customer_id, $body, $contentType); - } - - /** - * Operation updateCustomersConsentsClientSideWithHttpInfo - * - * Update Customer's consents (client-side) - * - * @param string $customer_id A Voucherify customer identifier or `source_id` (required) - * @param object $body Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use \"unsubscribed\" as a consent identifier and \"true\" as its value. #### Examples <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"cnst_aIdUulAh0SCsOCaS3005y7yS\": true, \"cnst_aIdUulAhwewqaS31213fdsfds\": false } ``` Opt-out from all communication: <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"unsubscribed\": true } ``` (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersConsentsClientSide'] to see the possible values for this operation - * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function updateCustomersConsentsClientSideWithHttpInfo($customer_id, $body = null, string $contentType = self::contentTypes['updateCustomersConsentsClientSide'][0]) - { - $request = $this->updateCustomersConsentsClientSideRequest($customer_id, $body, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation updateCustomersConsentsClientSideAsync - * - * Update Customer's consents (client-side) - * - * @param string $customer_id A Voucherify customer identifier or `source_id` (required) - * @param object $body Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use \"unsubscribed\" as a consent identifier and \"true\" as its value. #### Examples <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"cnst_aIdUulAh0SCsOCaS3005y7yS\": true, \"cnst_aIdUulAhwewqaS31213fdsfds\": false } ``` Opt-out from all communication: <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"unsubscribed\": true } ``` (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersConsentsClientSide'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateCustomersConsentsClientSideAsync($customer_id, $body = null, string $contentType = self::contentTypes['updateCustomersConsentsClientSide'][0]) - { - return $this->updateCustomersConsentsClientSideAsyncWithHttpInfo($customer_id, $body, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateCustomersConsentsClientSideAsyncWithHttpInfo - * - * Update Customer's consents (client-side) - * - * @param string $customer_id A Voucherify customer identifier or `source_id` (required) - * @param object $body Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use \"unsubscribed\" as a consent identifier and \"true\" as its value. #### Examples <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"cnst_aIdUulAh0SCsOCaS3005y7yS\": true, \"cnst_aIdUulAhwewqaS31213fdsfds\": false } ``` Opt-out from all communication: <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"unsubscribed\": true } ``` (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersConsentsClientSide'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateCustomersConsentsClientSideAsyncWithHttpInfo($customer_id, $body = null, string $contentType = self::contentTypes['updateCustomersConsentsClientSide'][0]) - { - $returnType = ''; - $request = $this->updateCustomersConsentsClientSideRequest($customer_id, $body, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'updateCustomersConsentsClientSide' - * - * @param string $customer_id A Voucherify customer identifier or `source_id` (required) - * @param object $body Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use \"unsubscribed\" as a consent identifier and \"true\" as its value. #### Examples <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"cnst_aIdUulAh0SCsOCaS3005y7yS\": true, \"cnst_aIdUulAhwewqaS31213fdsfds\": false } ``` Opt-out from all communication: <!-- title: \"Request Body\" lineNumbers: true --> ```json { \"unsubscribed\": true } ``` (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersConsentsClientSide'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function updateCustomersConsentsClientSideRequest($customer_id, $body = null, string $contentType = self::contentTypes['updateCustomersConsentsClientSide'][0]) - { - - // verify the required parameter 'customer_id' is set - if ($customer_id === null || (is_array($customer_id) && count($customer_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $customer_id when calling updateCustomersConsentsClientSide' - ); - } - - - - $resourcePath = '/client/v1/customers/{customerId}/consents'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($customer_id !== null) { - $resourcePath = str_replace( - '{' . 'customerId' . '}', - ObjectSerializer::toPathValue($customer_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($body)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); - } else { - $httpBody = $body; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('X-Client-Application-Id'); - if ($apiKey !== null) { - $headers['X-Client-Application-Id'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('X-Client-Token'); - if ($apiKey !== null) { - $headers['X-Client-Token'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'PUT', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - /** * Operation updateCustomersInBulk * diff --git a/src/Api/EventsApi.php b/src/Api/EventsApi.php index 19893a9..8ed87f1 100644 --- a/src/Api/EventsApi.php +++ b/src/Api/EventsApi.php @@ -75,9 +75,6 @@ class EventsApi 'trackCustomEvent' => [ 'application/json', ], - 'trackCustomEventClientSide' => [ - 'application/json', - ], ]; /** @@ -412,308 +409,6 @@ public function trackCustomEventRequest($events_create_request_body = null, stri ); } - /** - * Operation trackCustomEventClientSide - * - * Track Custom Event (client-side) - * - * @param string $origin Indicates the origin (scheme, hostname, and port). (required) - * @param \OpenAPI\Client\Model\ClientEventsCreateRequestBody $client_events_create_request_body Specify the details of the custom event. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackCustomEventClientSide'] to see the possible values for this operation - * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \OpenAPI\Client\Model\ClientEventsCreateResponseBody - */ - public function trackCustomEventClientSide($origin, $client_events_create_request_body = null, string $contentType = self::contentTypes['trackCustomEventClientSide'][0]) - { - list($response) = $this->trackCustomEventClientSideWithHttpInfo($origin, $client_events_create_request_body, $contentType); - return $response; - } - - /** - * Operation trackCustomEventClientSideWithHttpInfo - * - * Track Custom Event (client-side) - * - * @param string $origin Indicates the origin (scheme, hostname, and port). (required) - * @param \OpenAPI\Client\Model\ClientEventsCreateRequestBody $client_events_create_request_body Specify the details of the custom event. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackCustomEventClientSide'] to see the possible values for this operation - * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\ClientEventsCreateResponseBody, HTTP status code, HTTP response headers (array of strings) - */ - public function trackCustomEventClientSideWithHttpInfo($origin, $client_events_create_request_body = null, string $contentType = self::contentTypes['trackCustomEventClientSide'][0]) - { - $request = $this->trackCustomEventClientSideRequest($origin, $client_events_create_request_body, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 200: - if ('\OpenAPI\Client\Model\ClientEventsCreateResponseBody' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\OpenAPI\Client\Model\ClientEventsCreateResponseBody' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ClientEventsCreateResponseBody', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\OpenAPI\Client\Model\ClientEventsCreateResponseBody'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\OpenAPI\Client\Model\ClientEventsCreateResponseBody', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation trackCustomEventClientSideAsync - * - * Track Custom Event (client-side) - * - * @param string $origin Indicates the origin (scheme, hostname, and port). (required) - * @param \OpenAPI\Client\Model\ClientEventsCreateRequestBody $client_events_create_request_body Specify the details of the custom event. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackCustomEventClientSide'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function trackCustomEventClientSideAsync($origin, $client_events_create_request_body = null, string $contentType = self::contentTypes['trackCustomEventClientSide'][0]) - { - return $this->trackCustomEventClientSideAsyncWithHttpInfo($origin, $client_events_create_request_body, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation trackCustomEventClientSideAsyncWithHttpInfo - * - * Track Custom Event (client-side) - * - * @param string $origin Indicates the origin (scheme, hostname, and port). (required) - * @param \OpenAPI\Client\Model\ClientEventsCreateRequestBody $client_events_create_request_body Specify the details of the custom event. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackCustomEventClientSide'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function trackCustomEventClientSideAsyncWithHttpInfo($origin, $client_events_create_request_body = null, string $contentType = self::contentTypes['trackCustomEventClientSide'][0]) - { - $returnType = '\OpenAPI\Client\Model\ClientEventsCreateResponseBody'; - $request = $this->trackCustomEventClientSideRequest($origin, $client_events_create_request_body, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'trackCustomEventClientSide' - * - * @param string $origin Indicates the origin (scheme, hostname, and port). (required) - * @param \OpenAPI\Client\Model\ClientEventsCreateRequestBody $client_events_create_request_body Specify the details of the custom event. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['trackCustomEventClientSide'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function trackCustomEventClientSideRequest($origin, $client_events_create_request_body = null, string $contentType = self::contentTypes['trackCustomEventClientSide'][0]) - { - - // verify the required parameter 'origin' is set - if ($origin === null || (is_array($origin) && count($origin) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $origin when calling trackCustomEventClientSide' - ); - } - - - - $resourcePath = '/client/v1/events'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - // header params - if ($origin !== null) { - $headerParams['origin'] = ObjectSerializer::toHeaderValue($origin); - } - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($client_events_create_request_body)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($client_events_create_request_body)); - } else { - $httpBody = $client_events_create_request_body; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('X-Client-Application-Id'); - if ($apiKey !== null) { - $headers['X-Client-Application-Id'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('X-Client-Token'); - if ($apiKey !== null) { - $headers['X-Client-Token'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - /** * Create http client option * diff --git a/src/Api/QualificationsApi.php b/src/Api/QualificationsApi.php index 08a4fa0..5da53ae 100644 --- a/src/Api/QualificationsApi.php +++ b/src/Api/QualificationsApi.php @@ -75,9 +75,6 @@ class QualificationsApi 'checkEligibility' => [ 'application/json', ], - 'checkEligibilityClientSide' => [ - 'application/json', - ], ]; /** @@ -412,292 +409,6 @@ public function checkEligibilityRequest($qualifications_check_eligibility_reques ); } - /** - * Operation checkEligibilityClientSide - * - * Check Eligibility (client-side) - * - * @param \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBody $client_qualifications_check_eligibility_request_body Define order and customer context. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEligibilityClientSide'] to see the possible values for this operation - * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityResponseBody - */ - public function checkEligibilityClientSide($client_qualifications_check_eligibility_request_body = null, string $contentType = self::contentTypes['checkEligibilityClientSide'][0]) - { - list($response) = $this->checkEligibilityClientSideWithHttpInfo($client_qualifications_check_eligibility_request_body, $contentType); - return $response; - } - - /** - * Operation checkEligibilityClientSideWithHttpInfo - * - * Check Eligibility (client-side) - * - * @param \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBody $client_qualifications_check_eligibility_request_body Define order and customer context. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEligibilityClientSide'] to see the possible values for this operation - * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityResponseBody, HTTP status code, HTTP response headers (array of strings) - */ - public function checkEligibilityClientSideWithHttpInfo($client_qualifications_check_eligibility_request_body = null, string $contentType = self::contentTypes['checkEligibilityClientSide'][0]) - { - $request = $this->checkEligibilityClientSideRequest($client_qualifications_check_eligibility_request_body, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 200: - if ('\OpenAPI\Client\Model\ClientQualificationsCheckEligibilityResponseBody' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\OpenAPI\Client\Model\ClientQualificationsCheckEligibilityResponseBody' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ClientQualificationsCheckEligibilityResponseBody', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\OpenAPI\Client\Model\ClientQualificationsCheckEligibilityResponseBody'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\OpenAPI\Client\Model\ClientQualificationsCheckEligibilityResponseBody', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation checkEligibilityClientSideAsync - * - * Check Eligibility (client-side) - * - * @param \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBody $client_qualifications_check_eligibility_request_body Define order and customer context. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEligibilityClientSide'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function checkEligibilityClientSideAsync($client_qualifications_check_eligibility_request_body = null, string $contentType = self::contentTypes['checkEligibilityClientSide'][0]) - { - return $this->checkEligibilityClientSideAsyncWithHttpInfo($client_qualifications_check_eligibility_request_body, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation checkEligibilityClientSideAsyncWithHttpInfo - * - * Check Eligibility (client-side) - * - * @param \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBody $client_qualifications_check_eligibility_request_body Define order and customer context. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEligibilityClientSide'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function checkEligibilityClientSideAsyncWithHttpInfo($client_qualifications_check_eligibility_request_body = null, string $contentType = self::contentTypes['checkEligibilityClientSide'][0]) - { - $returnType = '\OpenAPI\Client\Model\ClientQualificationsCheckEligibilityResponseBody'; - $request = $this->checkEligibilityClientSideRequest($client_qualifications_check_eligibility_request_body, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'checkEligibilityClientSide' - * - * @param \OpenAPI\Client\Model\ClientQualificationsCheckEligibilityRequestBody $client_qualifications_check_eligibility_request_body Define order and customer context. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkEligibilityClientSide'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function checkEligibilityClientSideRequest($client_qualifications_check_eligibility_request_body = null, string $contentType = self::contentTypes['checkEligibilityClientSide'][0]) - { - - - - $resourcePath = '/client/v1/qualifications'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($client_qualifications_check_eligibility_request_body)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($client_qualifications_check_eligibility_request_body)); - } else { - $httpBody = $client_qualifications_check_eligibility_request_body; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('X-Client-Application-Id'); - if ($apiKey !== null) { - $headers['X-Client-Application-Id'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('X-Client-Token'); - if ($apiKey !== null) { - $headers['X-Client-Token'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - /** * Create http client option * diff --git a/src/Api/RedemptionsApi.php b/src/Api/RedemptionsApi.php index 7a805de..75cfa44 100644 --- a/src/Api/RedemptionsApi.php +++ b/src/Api/RedemptionsApi.php @@ -81,9 +81,15 @@ class RedemptionsApi 'listRedemptions' => [ 'application/json', ], + 'redeemStackedDiscounts' => [ + 'application/json', + ], 'rollbackRedemption' => [ 'application/json', ], + 'rollbackStackedRedemptions' => [ + 'application/json', + ], ]; /** @@ -1120,6 +1126,292 @@ public function listRedemptionsRequest($limit = null, $page = null, $result = nu ); } + /** + * Operation redeemStackedDiscounts + * + * Redeem Stackable Discounts + * + * @param \OpenAPI\Client\Model\RedemptionsRedeemRequestBody $redemptions_redeem_request_body redemptions_redeem_request_body (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemStackedDiscounts'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\RedemptionsRedeemResponseBody + */ + public function redeemStackedDiscounts($redemptions_redeem_request_body = null, string $contentType = self::contentTypes['redeemStackedDiscounts'][0]) + { + list($response) = $this->redeemStackedDiscountsWithHttpInfo($redemptions_redeem_request_body, $contentType); + return $response; + } + + /** + * Operation redeemStackedDiscountsWithHttpInfo + * + * Redeem Stackable Discounts + * + * @param \OpenAPI\Client\Model\RedemptionsRedeemRequestBody $redemptions_redeem_request_body (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemStackedDiscounts'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\RedemptionsRedeemResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function redeemStackedDiscountsWithHttpInfo($redemptions_redeem_request_body = null, string $contentType = self::contentTypes['redeemStackedDiscounts'][0]) + { + $request = $this->redeemStackedDiscountsRequest($redemptions_redeem_request_body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\RedemptionsRedeemResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\RedemptionsRedeemResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\RedemptionsRedeemResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\RedemptionsRedeemResponseBody'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\RedemptionsRedeemResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation redeemStackedDiscountsAsync + * + * Redeem Stackable Discounts + * + * @param \OpenAPI\Client\Model\RedemptionsRedeemRequestBody $redemptions_redeem_request_body (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemStackedDiscounts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function redeemStackedDiscountsAsync($redemptions_redeem_request_body = null, string $contentType = self::contentTypes['redeemStackedDiscounts'][0]) + { + return $this->redeemStackedDiscountsAsyncWithHttpInfo($redemptions_redeem_request_body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation redeemStackedDiscountsAsyncWithHttpInfo + * + * Redeem Stackable Discounts + * + * @param \OpenAPI\Client\Model\RedemptionsRedeemRequestBody $redemptions_redeem_request_body (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemStackedDiscounts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function redeemStackedDiscountsAsyncWithHttpInfo($redemptions_redeem_request_body = null, string $contentType = self::contentTypes['redeemStackedDiscounts'][0]) + { + $returnType = '\OpenAPI\Client\Model\RedemptionsRedeemResponseBody'; + $request = $this->redeemStackedDiscountsRequest($redemptions_redeem_request_body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'redeemStackedDiscounts' + * + * @param \OpenAPI\Client\Model\RedemptionsRedeemRequestBody $redemptions_redeem_request_body (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['redeemStackedDiscounts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function redeemStackedDiscountsRequest($redemptions_redeem_request_body = null, string $contentType = self::contentTypes['redeemStackedDiscounts'][0]) + { + + + + $resourcePath = '/v1/redemptions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($redemptions_redeem_request_body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($redemptions_redeem_request_body)); + } else { + $httpBody = $redemptions_redeem_request_body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-App-Id'); + if ($apiKey !== null) { + $headers['X-App-Id'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-App-Token'); + if ($apiKey !== null) { + $headers['X-App-Token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation rollbackRedemption * @@ -1456,6 +1748,342 @@ public function rollbackRedemptionRequest($redemption_id, $reason = null, $track ); } + /** + * Operation rollbackStackedRedemptions + * + * Rollback Stackable Redemptions + * + * @param string $parent_redemption_id Unique identifier of a parent redemption, e.g. `r_JQfm73zWSJFQxs3bGxweYjgm`. (required) + * @param string $reason Reason for the rollback. (optional) + * @param string $tracking_id Customer's `source_id`. (optional) + * @param \OpenAPI\Client\Model\RedemptionsRollbacksCreateRequestBody $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. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rollbackStackedRedemptions'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\RedemptionsRollbacksCreateResponseBody + */ + public function rollbackStackedRedemptions($parent_redemption_id, $reason = null, $tracking_id = null, $redemptions_rollbacks_create_request_body = null, string $contentType = self::contentTypes['rollbackStackedRedemptions'][0]) + { + list($response) = $this->rollbackStackedRedemptionsWithHttpInfo($parent_redemption_id, $reason, $tracking_id, $redemptions_rollbacks_create_request_body, $contentType); + return $response; + } + + /** + * Operation rollbackStackedRedemptionsWithHttpInfo + * + * Rollback Stackable Redemptions + * + * @param string $parent_redemption_id Unique identifier of a parent redemption, e.g. `r_JQfm73zWSJFQxs3bGxweYjgm`. (required) + * @param string $reason Reason for the rollback. (optional) + * @param string $tracking_id Customer's `source_id`. (optional) + * @param \OpenAPI\Client\Model\RedemptionsRollbacksCreateRequestBody $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. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rollbackStackedRedemptions'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\RedemptionsRollbacksCreateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function rollbackStackedRedemptionsWithHttpInfo($parent_redemption_id, $reason = null, $tracking_id = null, $redemptions_rollbacks_create_request_body = null, string $contentType = self::contentTypes['rollbackStackedRedemptions'][0]) + { + $request = $this->rollbackStackedRedemptionsRequest($parent_redemption_id, $reason, $tracking_id, $redemptions_rollbacks_create_request_body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\RedemptionsRollbacksCreateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\RedemptionsRollbacksCreateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\RedemptionsRollbacksCreateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\RedemptionsRollbacksCreateResponseBody'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\RedemptionsRollbacksCreateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation rollbackStackedRedemptionsAsync + * + * Rollback Stackable Redemptions + * + * @param string $parent_redemption_id Unique identifier of a parent redemption, e.g. `r_JQfm73zWSJFQxs3bGxweYjgm`. (required) + * @param string $reason Reason for the rollback. (optional) + * @param string $tracking_id Customer's `source_id`. (optional) + * @param \OpenAPI\Client\Model\RedemptionsRollbacksCreateRequestBody $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. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rollbackStackedRedemptions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function rollbackStackedRedemptionsAsync($parent_redemption_id, $reason = null, $tracking_id = null, $redemptions_rollbacks_create_request_body = null, string $contentType = self::contentTypes['rollbackStackedRedemptions'][0]) + { + return $this->rollbackStackedRedemptionsAsyncWithHttpInfo($parent_redemption_id, $reason, $tracking_id, $redemptions_rollbacks_create_request_body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation rollbackStackedRedemptionsAsyncWithHttpInfo + * + * Rollback Stackable Redemptions + * + * @param string $parent_redemption_id Unique identifier of a parent redemption, e.g. `r_JQfm73zWSJFQxs3bGxweYjgm`. (required) + * @param string $reason Reason for the rollback. (optional) + * @param string $tracking_id Customer's `source_id`. (optional) + * @param \OpenAPI\Client\Model\RedemptionsRollbacksCreateRequestBody $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. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rollbackStackedRedemptions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function rollbackStackedRedemptionsAsyncWithHttpInfo($parent_redemption_id, $reason = null, $tracking_id = null, $redemptions_rollbacks_create_request_body = null, string $contentType = self::contentTypes['rollbackStackedRedemptions'][0]) + { + $returnType = '\OpenAPI\Client\Model\RedemptionsRollbacksCreateResponseBody'; + $request = $this->rollbackStackedRedemptionsRequest($parent_redemption_id, $reason, $tracking_id, $redemptions_rollbacks_create_request_body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'rollbackStackedRedemptions' + * + * @param string $parent_redemption_id Unique identifier of a parent redemption, e.g. `r_JQfm73zWSJFQxs3bGxweYjgm`. (required) + * @param string $reason Reason for the rollback. (optional) + * @param string $tracking_id Customer's `source_id`. (optional) + * @param \OpenAPI\Client\Model\RedemptionsRollbacksCreateRequestBody $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. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['rollbackStackedRedemptions'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function rollbackStackedRedemptionsRequest($parent_redemption_id, $reason = null, $tracking_id = null, $redemptions_rollbacks_create_request_body = null, string $contentType = self::contentTypes['rollbackStackedRedemptions'][0]) + { + + // verify the required parameter 'parent_redemption_id' is set + if ($parent_redemption_id === null || (is_array($parent_redemption_id) && count($parent_redemption_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $parent_redemption_id when calling rollbackStackedRedemptions' + ); + } + + + + + + $resourcePath = '/v1/redemptions/{parentRedemptionId}/rollbacks'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $reason, + 'reason', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $tracking_id, + 'tracking_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($parent_redemption_id !== null) { + $resourcePath = str_replace( + '{' . 'parentRedemptionId' . '}', + ObjectSerializer::toPathValue($parent_redemption_id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($redemptions_rollbacks_create_request_body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($redemptions_rollbacks_create_request_body)); + } else { + $httpBody = $redemptions_rollbacks_create_request_body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-App-Id'); + if ($apiKey !== null) { + $headers['X-App-Id'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-App-Token'); + if ($apiKey !== null) { + $headers['X-App-Token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Create http client option * diff --git a/src/Api/ValidationsApi.php b/src/Api/ValidationsApi.php new file mode 100644 index 0000000..595b042 --- /dev/null +++ b/src/Api/ValidationsApi.php @@ -0,0 +1,430 @@ + [ + 'application/json', + ], + ]; + +/** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation validateStackedDiscounts + * + * Validate Stackable Discounts + * + * @param \OpenAPI\Client\Model\ValidationsValidateRequestBody $validations_validate_request_body validations_validate_request_body (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateStackedDiscounts'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\ValidationsValidateResponseBody + */ + public function validateStackedDiscounts($validations_validate_request_body = null, string $contentType = self::contentTypes['validateStackedDiscounts'][0]) + { + list($response) = $this->validateStackedDiscountsWithHttpInfo($validations_validate_request_body, $contentType); + return $response; + } + + /** + * Operation validateStackedDiscountsWithHttpInfo + * + * Validate Stackable Discounts + * + * @param \OpenAPI\Client\Model\ValidationsValidateRequestBody $validations_validate_request_body (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateStackedDiscounts'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\ValidationsValidateResponseBody, HTTP status code, HTTP response headers (array of strings) + */ + public function validateStackedDiscountsWithHttpInfo($validations_validate_request_body = null, string $contentType = self::contentTypes['validateStackedDiscounts'][0]) + { + $request = $this->validateStackedDiscountsRequest($validations_validate_request_body, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\ValidationsValidateResponseBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\ValidationsValidateResponseBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\ValidationsValidateResponseBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\ValidationsValidateResponseBody'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\ValidationsValidateResponseBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation validateStackedDiscountsAsync + * + * Validate Stackable Discounts + * + * @param \OpenAPI\Client\Model\ValidationsValidateRequestBody $validations_validate_request_body (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateStackedDiscounts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function validateStackedDiscountsAsync($validations_validate_request_body = null, string $contentType = self::contentTypes['validateStackedDiscounts'][0]) + { + return $this->validateStackedDiscountsAsyncWithHttpInfo($validations_validate_request_body, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation validateStackedDiscountsAsyncWithHttpInfo + * + * Validate Stackable Discounts + * + * @param \OpenAPI\Client\Model\ValidationsValidateRequestBody $validations_validate_request_body (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateStackedDiscounts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function validateStackedDiscountsAsyncWithHttpInfo($validations_validate_request_body = null, string $contentType = self::contentTypes['validateStackedDiscounts'][0]) + { + $returnType = '\OpenAPI\Client\Model\ValidationsValidateResponseBody'; + $request = $this->validateStackedDiscountsRequest($validations_validate_request_body, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'validateStackedDiscounts' + * + * @param \OpenAPI\Client\Model\ValidationsValidateRequestBody $validations_validate_request_body (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['validateStackedDiscounts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function validateStackedDiscountsRequest($validations_validate_request_body = null, string $contentType = self::contentTypes['validateStackedDiscounts'][0]) + { + + + + $resourcePath = '/v1/validations'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($validations_validate_request_body)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($validations_validate_request_body)); + } else { + $httpBody = $validations_validate_request_body; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-App-Id'); + if ($apiKey !== null) { + $headers['X-App-Id'] = $apiKey; + } + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-App-Token'); + if ($apiKey !== null) { + $headers['X-App-Token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/src/Model/CampaignsCreateRequestBody.php b/src/Model/CampaignsCreateRequestBody.php index cb61a05..3257531 100644 --- a/src/Model/CampaignsCreateRequestBody.php +++ b/src/Model/CampaignsCreateRequestBody.php @@ -354,7 +354,7 @@ public function getModelName() public const CAMPAIGN_TYPE_DISCOUNT_COUPONS = 'DISCOUNT_COUPONS'; public const CAMPAIGN_TYPE_REFERRAL_PROGRAM = 'REFERRAL_PROGRAM'; public const CAMPAIGN_TYPE_GIFT_VOUCHERS = 'GIFT_VOUCHERS'; - public const CAMPAIGN_TYPE_LOYALTY_CARD = 'LOYALTY_CARD'; + public const CAMPAIGN_TYPE_LOYALTY_PROGRAM = 'LOYALTY_PROGRAM'; public const CAMPAIGN_TYPE_PROMOTION = 'PROMOTION'; public const CAMPAIGN_TYPE_LUCKY_DRAW = 'LUCKY_DRAW'; @@ -382,7 +382,7 @@ public function getCampaignTypeAllowableValues() self::CAMPAIGN_TYPE_DISCOUNT_COUPONS, self::CAMPAIGN_TYPE_REFERRAL_PROGRAM, self::CAMPAIGN_TYPE_GIFT_VOUCHERS, - self::CAMPAIGN_TYPE_LOYALTY_CARD, + self::CAMPAIGN_TYPE_LOYALTY_PROGRAM, self::CAMPAIGN_TYPE_PROMOTION, self::CAMPAIGN_TYPE_LUCKY_DRAW, ]; diff --git a/src/Model/ClientValidationsValidateResponseBody.php b/src/Model/ClientValidationsValidateResponseBody.php index 5616850..b18eb0d 100644 --- a/src/Model/ClientValidationsValidateResponseBody.php +++ b/src/Model/ClientValidationsValidateResponseBody.php @@ -65,8 +65,7 @@ class ClientValidationsValidateResponseBody implements ModelInterface, ArrayAcce 'inapplicable_redeemables' => 'ValidationsRedeemableInapplicable[]', 'order' => '\OpenAPI\Client\Model\OrderCalculated', 'tracking_id' => 'string', - 'session' => '\OpenAPI\Client\Model\Session', - 'stacking_rules' => '\OpenAPI\Client\Model\StackingRules' + 'session' => '\OpenAPI\Client\Model\Session' ]; /** @@ -83,8 +82,7 @@ class ClientValidationsValidateResponseBody implements ModelInterface, ArrayAcce 'inapplicable_redeemables' => null, 'order' => null, 'tracking_id' => null, - 'session' => null, - 'stacking_rules' => null + 'session' => null ]; /** @@ -99,8 +97,7 @@ class ClientValidationsValidateResponseBody implements ModelInterface, ArrayAcce 'inapplicable_redeemables' => false, 'order' => false, 'tracking_id' => false, - 'session' => false, - 'stacking_rules' => false + 'session' => false ]; /** @@ -195,8 +192,7 @@ public function isNullableSetToNull(string $property): bool 'inapplicable_redeemables' => 'inapplicable_redeemables', 'order' => 'order', 'tracking_id' => 'tracking_id', - 'session' => 'session', - 'stacking_rules' => 'stacking_rules' + 'session' => 'session' ]; /** @@ -211,8 +207,7 @@ public function isNullableSetToNull(string $property): bool 'inapplicable_redeemables' => 'setInapplicableRedeemables', 'order' => 'setOrder', 'tracking_id' => 'setTrackingId', - 'session' => 'setSession', - 'stacking_rules' => 'setStackingRules' + 'session' => 'setSession' ]; /** @@ -227,8 +222,7 @@ public function isNullableSetToNull(string $property): bool 'inapplicable_redeemables' => 'getInapplicableRedeemables', 'order' => 'getOrder', 'tracking_id' => 'getTrackingId', - 'session' => 'getSession', - 'stacking_rules' => 'getStackingRules' + 'session' => 'getSession' ]; /** @@ -295,7 +289,6 @@ public function __construct(array $data = null) $this->setIfExists('order', $data ?? [], null); $this->setIfExists('tracking_id', $data ?? [], null); $this->setIfExists('session', $data ?? [], null); - $this->setIfExists('stacking_rules', $data ?? [], null); } /** @@ -534,33 +527,6 @@ public function setSession($session) return $this; } - - /** - * Gets stacking_rules - * - * @return \OpenAPI\Client\Model\StackingRules|null - */ - public function getStackingRules() - { - return $this->container['stacking_rules']; - } - - /** - * Sets stacking_rules - * - * @param \OpenAPI\Client\Model\StackingRules|null $stacking_rules stacking_rules - * - * @return self - */ - public function setStackingRules($stacking_rules) - { - if (is_null($stacking_rules)) { - throw new \InvalidArgumentException('non-nullable stacking_rules cannot be null'); - } - $this->container['stacking_rules'] = $stacking_rules; - - return $this; - } /** * Returns true if offset exists. False otherwise. * diff --git a/src/Model/QualificationsOptionFilters.php b/src/Model/QualificationsOptionFilters.php index d7f0d2f..af92809 100644 --- a/src/Model/QualificationsOptionFilters.php +++ b/src/Model/QualificationsOptionFilters.php @@ -63,7 +63,7 @@ class QualificationsOptionFilters implements ModelInterface, ArrayAccess, \JsonS 'category_id' => '\OpenAPI\Client\Model\QualificationsFieldConditions', 'campaign_id' => '\OpenAPI\Client\Model\QualificationsFieldConditions', 'resource_id' => '\OpenAPI\Client\Model\QualificationsFieldConditions', - 'resource_type' => '\OpenAPI\Client\Model\QualificationsFieldConditions', + 'resource_type' => '\OpenAPI\Client\Model\QualificationsOptionFiltersResourceType', 'voucher_type' => '\OpenAPI\Client\Model\QualificationsFieldConditions', 'code' => '\OpenAPI\Client\Model\QualificationsFieldConditions' ]; @@ -478,7 +478,7 @@ public function setResourceId($resource_id) /** * Gets resource_type * - * @return \OpenAPI\Client\Model\QualificationsFieldConditions|null + * @return \OpenAPI\Client\Model\QualificationsOptionFiltersResourceType|null */ public function getResourceType() { @@ -488,7 +488,7 @@ public function getResourceType() /** * Sets resource_type * - * @param \OpenAPI\Client\Model\QualificationsFieldConditions|null $resource_type resource_type + * @param \OpenAPI\Client\Model\QualificationsOptionFiltersResourceType|null $resource_type resource_type * * @return self */ diff --git a/src/Model/QualificationsOptionFiltersResourceType.php b/src/Model/QualificationsOptionFiltersResourceType.php new file mode 100644 index 0000000..ced9e41 --- /dev/null +++ b/src/Model/QualificationsOptionFiltersResourceType.php @@ -0,0 +1,410 @@ + + */ +class QualificationsOptionFiltersResourceType implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QualificationsOption_filters_resource_type'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'conditions' => '\OpenAPI\Client\Model\QualificationsOptionFiltersResourceTypeConditions' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'conditions' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'conditions' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'conditions' => 'conditions' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'conditions' => 'setConditions' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'conditions' => 'getConditions' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('conditions', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets conditions + * + * @return \OpenAPI\Client\Model\QualificationsOptionFiltersResourceTypeConditions|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \OpenAPI\Client\Model\QualificationsOptionFiltersResourceTypeConditions|null $conditions conditions + * + * @return self + */ + public function setConditions($conditions) + { + if (is_null($conditions)) { + throw new \InvalidArgumentException('non-nullable conditions cannot be null'); + } + $this->container['conditions'] = $conditions; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/QualificationsOptionFiltersResourceTypeConditions.php b/src/Model/QualificationsOptionFiltersResourceTypeConditions.php new file mode 100644 index 0000000..bdcc590 --- /dev/null +++ b/src/Model/QualificationsOptionFiltersResourceTypeConditions.php @@ -0,0 +1,637 @@ + + */ +class QualificationsOptionFiltersResourceTypeConditions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QualificationsOption_filters_resource_type_conditions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'is' => 'string', + 'is_not' => 'string', + 'in' => 'string[]', + 'not_in' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'is' => null, + 'is_not' => null, + 'in' => null, + 'not_in' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'is' => false, + 'is_not' => false, + 'in' => false, + 'not_in' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'is' => '$is', + 'is_not' => '$is_not', + 'in' => '$in', + 'not_in' => '$not_in' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'is' => 'setIs', + 'is_not' => 'setIsNot', + 'in' => 'setIn', + 'not_in' => 'setNotIn' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'is' => 'getIs', + 'is_not' => 'getIsNot', + 'in' => 'getIn', + 'not_in' => 'getNotIn' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const IS_CAMPAIGN = 'campaign'; + public const IS_VOUCHER = 'voucher'; + public const IS_PROMOTION_TIER = 'promotion_tier'; + public const IS_NOT_CAMPAIGN = 'campaign'; + public const IS_NOT_VOUCHER = 'voucher'; + public const IS_NOT_PROMOTION_TIER = 'promotion_tier'; + public const IN_CAMPAIGN = 'campaign'; + public const IN_VOUCHER = 'voucher'; + public const IN_PROMOTION_TIER = 'promotion_tier'; + public const NOT_IN_CAMPAIGN = 'campaign'; + public const NOT_IN_VOUCHER = 'voucher'; + public const NOT_IN_PROMOTION_TIER = 'promotion_tier'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getIsAllowableValues() + { + return [ + self::IS_CAMPAIGN, + self::IS_VOUCHER, + self::IS_PROMOTION_TIER, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getIsNotAllowableValues() + { + return [ + self::IS_NOT_CAMPAIGN, + self::IS_NOT_VOUCHER, + self::IS_NOT_PROMOTION_TIER, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getInAllowableValues() + { + return [ + self::IN_CAMPAIGN, + self::IN_VOUCHER, + self::IN_PROMOTION_TIER, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getNotInAllowableValues() + { + return [ + self::NOT_IN_CAMPAIGN, + self::NOT_IN_VOUCHER, + self::NOT_IN_PROMOTION_TIER, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('is', $data ?? [], null); + $this->setIfExists('is_not', $data ?? [], null); + $this->setIfExists('in', $data ?? [], null); + $this->setIfExists('not_in', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getIsAllowableValues(); + if (!is_null($this->container['is']) && !in_array($this->container['is'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'is', must be one of '%s'", + $this->container['is'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getIsNotAllowableValues(); + if (!is_null($this->container['is_not']) && !in_array($this->container['is_not'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'is_not', must be one of '%s'", + $this->container['is_not'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets is + * + * @return string|null + */ + public function getIs() + { + return $this->container['is']; + } + + /** + * Sets is + * + * @param string|null $is Types of usable resources. + * + * @return self + */ + public function setIs($is) + { + if (is_null($is)) { + throw new \InvalidArgumentException('non-nullable is cannot be null'); + } + $allowedValues = $this->getIsAllowableValues(); + if (!in_array($is, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'is', must be one of '%s'", + $is, + implode("', '", $allowedValues) + ) + ); + } + $this->container['is'] = $is; + + return $this; + } + + /** + * Gets is_not + * + * @return string|null + */ + public function getIsNot() + { + return $this->container['is_not']; + } + + /** + * Sets is_not + * + * @param string|null $is_not Types of usable resources. + * + * @return self + */ + public function setIsNot($is_not) + { + if (is_null($is_not)) { + throw new \InvalidArgumentException('non-nullable is_not cannot be null'); + } + $allowedValues = $this->getIsNotAllowableValues(); + if (!in_array($is_not, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'is_not', must be one of '%s'", + $is_not, + implode("', '", $allowedValues) + ) + ); + } + $this->container['is_not'] = $is_not; + + return $this; + } + + /** + * Gets in + * + * @return string[]|null + */ + public function getIn() + { + return $this->container['in']; + } + + /** + * Sets in + * + * @param string[]|null $in Array of qualified redeemables. Accepts more than one value. Returns the resource types entered in the array. + * + * @return self + */ + public function setIn($in) + { + if (is_null($in)) { + throw new \InvalidArgumentException('non-nullable in cannot be null'); + } + $allowedValues = $this->getInAllowableValues(); + if (array_diff($in, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'in', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['in'] = $in; + + return $this; + } + + /** + * Gets not_in + * + * @return string[]|null + */ + public function getNotIn() + { + return $this->container['not_in']; + } + + /** + * Sets not_in + * + * @param string[]|null $not_in Array of qualified redeemables. Accepts more than one value. Returns the resource types except those entered in the array. + * + * @return self + */ + public function setNotIn($not_in) + { + if (is_null($not_in)) { + throw new \InvalidArgumentException('non-nullable not_in cannot be null'); + } + $allowedValues = $this->getNotInAllowableValues(); + if (array_diff($not_in, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'not_in', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['not_in'] = $not_in; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/src/Model/ValidationsValidateResponseBody.php b/src/Model/ValidationsValidateResponseBody.php index ee753ce..ee320b8 100644 --- a/src/Model/ValidationsValidateResponseBody.php +++ b/src/Model/ValidationsValidateResponseBody.php @@ -65,8 +65,7 @@ class ValidationsValidateResponseBody implements ModelInterface, ArrayAccess, \J 'inapplicable_redeemables' => 'ValidationsRedeemableInapplicable[]', 'order' => '\OpenAPI\Client\Model\OrderCalculated', 'tracking_id' => 'string', - 'session' => '\OpenAPI\Client\Model\Session', - 'stacking_rules' => '\OpenAPI\Client\Model\StackingRules' + 'session' => '\OpenAPI\Client\Model\Session' ]; /** @@ -83,8 +82,7 @@ class ValidationsValidateResponseBody implements ModelInterface, ArrayAccess, \J 'inapplicable_redeemables' => null, 'order' => null, 'tracking_id' => null, - 'session' => null, - 'stacking_rules' => null + 'session' => null ]; /** @@ -99,8 +97,7 @@ class ValidationsValidateResponseBody implements ModelInterface, ArrayAccess, \J 'inapplicable_redeemables' => false, 'order' => false, 'tracking_id' => false, - 'session' => false, - 'stacking_rules' => false + 'session' => false ]; /** @@ -195,8 +192,7 @@ public function isNullableSetToNull(string $property): bool 'inapplicable_redeemables' => 'inapplicable_redeemables', 'order' => 'order', 'tracking_id' => 'tracking_id', - 'session' => 'session', - 'stacking_rules' => 'stacking_rules' + 'session' => 'session' ]; /** @@ -211,8 +207,7 @@ public function isNullableSetToNull(string $property): bool 'inapplicable_redeemables' => 'setInapplicableRedeemables', 'order' => 'setOrder', 'tracking_id' => 'setTrackingId', - 'session' => 'setSession', - 'stacking_rules' => 'setStackingRules' + 'session' => 'setSession' ]; /** @@ -227,8 +222,7 @@ public function isNullableSetToNull(string $property): bool 'inapplicable_redeemables' => 'getInapplicableRedeemables', 'order' => 'getOrder', 'tracking_id' => 'getTrackingId', - 'session' => 'getSession', - 'stacking_rules' => 'getStackingRules' + 'session' => 'getSession' ]; /** @@ -295,7 +289,6 @@ public function __construct(array $data = null) $this->setIfExists('order', $data ?? [], null); $this->setIfExists('tracking_id', $data ?? [], null); $this->setIfExists('session', $data ?? [], null); - $this->setIfExists('stacking_rules', $data ?? [], null); } /** @@ -534,33 +527,6 @@ public function setSession($session) return $this; } - - /** - * Gets stacking_rules - * - * @return \OpenAPI\Client\Model\StackingRules|null - */ - public function getStackingRules() - { - return $this->container['stacking_rules']; - } - - /** - * Sets stacking_rules - * - * @param \OpenAPI\Client\Model\StackingRules|null $stacking_rules stacking_rules - * - * @return self - */ - public function setStackingRules($stacking_rules) - { - if (is_null($stacking_rules)) { - throw new \InvalidArgumentException('non-nullable stacking_rules cannot be null'); - } - $this->container['stacking_rules'] = $stacking_rules; - - return $this; - } /** * Returns true if offset exists. False otherwise. *